Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 556cb5b

Browse files
bvwellsrghetia
authored andcommitted
Fix typo in view documentation and remove unnecessary type conversions (#1162)
* Remove unnecessary type conversions * Fix typo in view documentation
1 parent c3153da commit 556cb5b

File tree

6 files changed

+8
-10
lines changed

6 files changed

+8
-10
lines changed

metric/cumulative.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (e *Int64CumulativeEntry) Inc(val int64) {
116116
if val <= 0 {
117117
return
118118
}
119-
atomic.AddInt64(&e.val, int64(val))
119+
atomic.AddInt64(&e.val, val)
120120
}
121121

122122
// Int64DerivedCumulative represents int64 cumulative value that is derived from an object.

metric/metricexport/reader_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ var (
3333
exporter1 = &metricExporter{}
3434
exporter2 = &metricExporter{}
3535
gaugeEntry *metric.Int64GaugeEntry
36-
duration1 = time.Duration(1000 * time.Millisecond)
37-
duration2 = time.Duration(2000 * time.Millisecond)
36+
duration1 = 1000 * time.Millisecond
37+
duration2 = 2000 * time.Millisecond
3838
)
3939

4040
type metricExporter struct {
@@ -194,7 +194,7 @@ func TestNewIntervalReaderWithNilExporter(t *testing.T) {
194194

195195
func TestNewIntervalReaderStartWithInvalidInterval(t *testing.T) {
196196
ir, err := NewIntervalReader(reader1, exporter1)
197-
ir.ReportingInterval = time.Duration(500 * time.Millisecond)
197+
ir.ReportingInterval = 500 * time.Millisecond
198198
err = ir.Start()
199199
if err == nil {
200200
t.Fatalf("expected error but got nil\n")

plugin/ochttp/server.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (h *Handler) startTrace(w http.ResponseWriter, r *http.Request) (*http.Requ
128128
// TODO: Handle cases where ContentLength is not set.
129129
} else if r.ContentLength > 0 {
130130
span.AddMessageReceiveEvent(0, /* TODO: messageID */
131-
int64(r.ContentLength), -1)
131+
r.ContentLength, -1)
132132
}
133133
return r.WithContext(ctx), span.End
134134
}
@@ -174,8 +174,6 @@ type trackingResponseWriter struct {
174174
// Compile time assertion for ResponseWriter interface
175175
var _ http.ResponseWriter = (*trackingResponseWriter)(nil)
176176

177-
var logTagsErrorOnce sync.Once
178-
179177
func (t *trackingResponseWriter) end(tags *addedTags) {
180178
t.endOnce.Do(func() {
181179
if t.statusCode == 0 {

stats/view/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
// LastValue just keeps track of the most recently recorded measurement value.
3030
// All aggregations are cumulative.
3131
//
32-
// Views can be registerd and unregistered at any time during program execution.
32+
// Views can be registered and unregistered at any time during program execution.
3333
//
3434
// Libraries can define views but it is recommended that in most cases registering
3535
// views be left up to applications.

tag/map_codec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func Encode(m *Map) []byte {
168168
eg := &encoderGRPC{
169169
buf: make([]byte, len(m.m)),
170170
}
171-
eg.writeByte(byte(tagsVersionID))
171+
eg.writeByte(tagsVersionID)
172172
for k, v := range m.m {
173173
if v.m.ttl.ttl == valueTTLUnlimitedPropagation {
174174
eg.writeByte(byte(keyTypeString))

tag/map_codec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func TestEncodeDecode(t *testing.T) {
9191

9292
got := make([]keyValue, 0)
9393
for k, v := range decoded.m {
94-
got = append(got, keyValue{k, string(v.value)})
94+
got = append(got, keyValue{k, v.value})
9595
}
9696
want := tc.pairs
9797

0 commit comments

Comments
 (0)