Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Remove "_ms" suffix from request latency metric name
Browse files Browse the repository at this point in the history
In practice, the precision of the recorded timing values
depends on the metrics backend and the client library.
Since we're using time.Duration based API, we cannot claim
the unit of measure in the metric name.
  • Loading branch information
Yuri Shkuro committed Mar 21, 2017
1 parent bcc8018 commit b798182
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rpcmetrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ type Metrics struct {
// Failures is a counter of the number of times any failure has been observed.
Failures metrics.Counter `metric:"failures"`

// RequestLatencyMs is a histogram of the latency of requests in milliseconds.
RequestLatencyMs metrics.Timer `metric:"request_latency_ms"`
// RequestLatency is a histogram of the latency of requests.
RequestLatency metrics.Timer `metric:"request_latency"`

// HTTPStatusCode2xx is a counter of the total number of requests with HTTP status code 200-299
HTTPStatusCode2xx metrics.Counter `metric:"http_status_code_2xx"`
Expand Down
2 changes: 1 addition & 1 deletion rpcmetrics/observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (so *SpanObserver) OnFinish(options opentracing.FinishOptions) {
} else {
mets.Success.Inc(1)
}
mets.RequestLatencyMs.Record(options.FinishTime.Sub(so.startTime))
mets.RequestLatency.Record(options.FinishTime.Sub(so.startTime))
mets.recordHTTPStatusCode(so.httpStatusCode)
}

Expand Down
2 changes: 1 addition & 1 deletion rpcmetrics/observer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func TestObserver(t *testing.T) {
// TODO something wrong with string generation, .P99 should not be appended to the tag
// as a result we cannot use u.AssertGaugeMetrics
_, g := testTracer.metrics.Snapshot()
assert.EqualValues(t, 51, g["request_latency_ms|endpoint=get-user.P99"])
assert.EqualValues(t, 51, g["request_latency|endpoint=get-user.P99"])
})
}

Expand Down

0 comments on commit b798182

Please sign in to comment.