зеркало из https://github.com/Azure/ARO-RP.git
Emit duration metrics as ints. Percentile metrics cannot calculated on floats.
This commit is contained in:
Родитель
ad2e88027a
Коммит
09979e195f
|
@ -63,7 +63,7 @@ func (ocb *openShiftClusterBackend) try(ctx context.Context) (bool, error) {
|
|||
ocb.m.EmitGauge("backend.openshiftcluster.workers.count", int64(atomic.LoadInt32(&ocb.workers)), nil)
|
||||
ocb.cond.Signal()
|
||||
|
||||
ocb.m.EmitFloat("backend.openshiftcluster.duration", time.Now().Sub(t).Seconds(), map[string]string{
|
||||
ocb.m.EmitGauge("backend.openshiftcluster.duration", time.Now().Sub(t).Milliseconds(), map[string]string{
|
||||
"state": string(doc.OpenShiftCluster.Properties.ProvisioningState),
|
||||
})
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ func (sb *subscriptionBackend) try(ctx context.Context) (bool, error) {
|
|||
sb.m.EmitGauge("backend.subscriptions.workers.count", int64(atomic.LoadInt32(&sb.workers)), nil)
|
||||
sb.cond.Signal()
|
||||
|
||||
sb.m.EmitFloat("backend.subscriptions.duration", time.Now().Sub(t).Seconds(), map[string]string{
|
||||
sb.m.EmitGauge("backend.subscriptions.duration", time.Now().Sub(t).Milliseconds(), map[string]string{
|
||||
"state": string(doc.Subscription.State),
|
||||
})
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ func Metrics(m metrics.Interface) func(http.Handler) http.Handler {
|
|||
"route": routeName,
|
||||
})
|
||||
|
||||
m.EmitFloat("frontend.duration", time.Now().Sub(t).Seconds(), map[string]string{
|
||||
m.EmitGauge("frontend.duration", time.Now().Sub(t).Milliseconds(), map[string]string{
|
||||
"verb": r.Method,
|
||||
"api-version": vars["api-version"],
|
||||
"code": strconv.Itoa(w.(*logResponseWriter).statusCode),
|
||||
|
|
|
@ -52,7 +52,7 @@ func (t *tracer) StartSpan(ctx context.Context, name string) context.Context {
|
|||
func (t *tracer) EndSpan(ctx context.Context, httpStatusCode int, err error) {
|
||||
metric := ctx.Value(contextKeyMetric).(metric)
|
||||
|
||||
t.m.EmitFloat("client.azure.duration", time.Now().Sub(metric.t).Seconds(), map[string]string{
|
||||
t.m.EmitGauge("client.azure.duration", time.Now().Sub(metric.t).Milliseconds(), map[string]string{
|
||||
"client": metric.name,
|
||||
"code": strconv.Itoa(httpStatusCode),
|
||||
})
|
||||
|
|
|
@ -20,7 +20,7 @@ func TestTracer(t *testing.T) {
|
|||
|
||||
m := mock_metrics.NewMockInterface(controller)
|
||||
|
||||
m.EXPECT().EmitFloat("client.azure.duration", gomock.Any(), map[string]string{
|
||||
m.EXPECT().EmitGauge("client.azure.duration", gomock.Any(), map[string]string{
|
||||
"client": "test",
|
||||
"code": "401",
|
||||
})
|
||||
|
|
|
@ -51,7 +51,7 @@ func (t *tracerRoundTripper) RoundTrip(req *http.Request) (resp *http.Response,
|
|||
"path": path,
|
||||
})
|
||||
|
||||
t.m.EmitFloat("client.cosmosdb.duration", time.Now().Sub(start).Seconds(), map[string]string{
|
||||
t.m.EmitGauge("client.cosmosdb.duration", time.Now().Sub(start).Milliseconds(), map[string]string{
|
||||
"code": strconv.Itoa(statusCode),
|
||||
"verb": req.Method,
|
||||
"path": path,
|
||||
|
|
|
@ -43,7 +43,7 @@ func TestTracerRoundTripperRoundTrip(t *testing.T) {
|
|||
"path": "/foo",
|
||||
"code": "0",
|
||||
})
|
||||
m.EXPECT().EmitFloat("client.cosmosdb.duration", gomock.Any(), map[string]string{
|
||||
m.EXPECT().EmitGauge("client.cosmosdb.duration", gomock.Any(), map[string]string{
|
||||
"verb": http.MethodGet,
|
||||
"path": "/foo",
|
||||
"code": "0",
|
||||
|
@ -72,7 +72,7 @@ func TestTracerRoundTripperRoundTrip(t *testing.T) {
|
|||
"path": "/foo",
|
||||
"code": "401",
|
||||
})
|
||||
m.EXPECT().EmitFloat("client.cosmosdb.duration", gomock.Any(), map[string]string{
|
||||
m.EXPECT().EmitGauge("client.cosmosdb.duration", gomock.Any(), map[string]string{
|
||||
"verb": http.MethodGet,
|
||||
"path": "/foo",
|
||||
"code": "401",
|
||||
|
@ -97,7 +97,7 @@ func TestTracerRoundTripperRoundTrip(t *testing.T) {
|
|||
"path": "/docs/{id}",
|
||||
"code": "200",
|
||||
})
|
||||
m.EXPECT().EmitFloat("client.cosmosdb.duration", gomock.Any(), map[string]string{
|
||||
m.EXPECT().EmitGauge("client.cosmosdb.duration", gomock.Any(), map[string]string{
|
||||
"verb": http.MethodGet,
|
||||
"path": "/docs/{id}",
|
||||
"code": "200",
|
||||
|
|
|
@ -37,7 +37,7 @@ func NewResult(m metrics.Interface) k8smetrics.ResultMetric {
|
|||
}
|
||||
|
||||
func (t *tracer) Observe(verb string, url url.URL, latency time.Duration) {
|
||||
t.m.EmitFloat("client.k8s.duration", latency.Seconds(), map[string]string{
|
||||
t.m.EmitGauge("client.k8s.duration", latency.Milliseconds(), map[string]string{
|
||||
"path": url.Path,
|
||||
"verb": verb,
|
||||
})
|
||||
|
|
Загрузка…
Ссылка в новой задаче