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

Commit

Permalink
Fix typo in view documentation and remove unnecessary type conversions (
Browse files Browse the repository at this point in the history
#1162)

* Remove unnecessary type conversions

* Fix typo in view documentation
  • Loading branch information
bvwells authored and rghetia committed Sep 4, 2019
1 parent c3153da commit 556cb5b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion metric/cumulative.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (e *Int64CumulativeEntry) Inc(val int64) {
if val <= 0 {
return
}
atomic.AddInt64(&e.val, int64(val))
atomic.AddInt64(&e.val, val)
}

// Int64DerivedCumulative represents int64 cumulative value that is derived from an object.
Expand Down
6 changes: 3 additions & 3 deletions metric/metricexport/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ var (
exporter1 = &metricExporter{}
exporter2 = &metricExporter{}
gaugeEntry *metric.Int64GaugeEntry
duration1 = time.Duration(1000 * time.Millisecond)
duration2 = time.Duration(2000 * time.Millisecond)
duration1 = 1000 * time.Millisecond
duration2 = 2000 * time.Millisecond
)

type metricExporter struct {
Expand Down Expand Up @@ -194,7 +194,7 @@ func TestNewIntervalReaderWithNilExporter(t *testing.T) {

func TestNewIntervalReaderStartWithInvalidInterval(t *testing.T) {
ir, err := NewIntervalReader(reader1, exporter1)
ir.ReportingInterval = time.Duration(500 * time.Millisecond)
ir.ReportingInterval = 500 * time.Millisecond
err = ir.Start()
if err == nil {
t.Fatalf("expected error but got nil\n")
Expand Down
4 changes: 1 addition & 3 deletions plugin/ochttp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (h *Handler) startTrace(w http.ResponseWriter, r *http.Request) (*http.Requ
// TODO: Handle cases where ContentLength is not set.
} else if r.ContentLength > 0 {
span.AddMessageReceiveEvent(0, /* TODO: messageID */
int64(r.ContentLength), -1)
r.ContentLength, -1)
}
return r.WithContext(ctx), span.End
}
Expand Down Expand Up @@ -174,8 +174,6 @@ type trackingResponseWriter struct {
// Compile time assertion for ResponseWriter interface
var _ http.ResponseWriter = (*trackingResponseWriter)(nil)

var logTagsErrorOnce sync.Once

func (t *trackingResponseWriter) end(tags *addedTags) {
t.endOnce.Do(func() {
if t.statusCode == 0 {
Expand Down
2 changes: 1 addition & 1 deletion stats/view/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// LastValue just keeps track of the most recently recorded measurement value.
// All aggregations are cumulative.
//
// Views can be registerd and unregistered at any time during program execution.
// Views can be registered and unregistered at any time during program execution.
//
// Libraries can define views but it is recommended that in most cases registering
// views be left up to applications.
Expand Down
2 changes: 1 addition & 1 deletion tag/map_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func Encode(m *Map) []byte {
eg := &encoderGRPC{
buf: make([]byte, len(m.m)),
}
eg.writeByte(byte(tagsVersionID))
eg.writeByte(tagsVersionID)
for k, v := range m.m {
if v.m.ttl.ttl == valueTTLUnlimitedPropagation {
eg.writeByte(byte(keyTypeString))
Expand Down
2 changes: 1 addition & 1 deletion tag/map_codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestEncodeDecode(t *testing.T) {

got := make([]keyValue, 0)
for k, v := range decoded.m {
got = append(got, keyValue{k, string(v.value)})
got = append(got, keyValue{k, v.value})
}
want := tc.pairs

Expand Down

0 comments on commit 556cb5b

Please sign in to comment.