-
Notifications
You must be signed in to change notification settings - Fork 288
Normalize metric names and tags #222
Changes from all commits
8141901
0cbfbea
5bc8d15
abd1f54
fed1ced
4f1e032
b6743c7
9add458
14c449e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,63 +33,61 @@ type Metrics struct { | |
TracesJoinedNotSampled metrics.Counter `metric:"traces" tags:"state=joined,sampled=n"` | ||
|
||
// Number of sampled spans started by this tracer | ||
SpansStarted metrics.Counter `metric:"spans" tags:"group=lifecycle,state=started"` | ||
SpansStartedSampled metrics.Counter `metric:"started_spans" tags:"sampled=y"` | ||
|
||
// Number of sampled spans finished by this tracer | ||
SpansFinished metrics.Counter `metric:"spans" tags:"group=lifecycle,state=finished"` | ||
// Number of unsampled spans started by this tracer | ||
SpansStartedNotSampled metrics.Counter `metric:"started_spans" tags:"sampled=n"` | ||
|
||
// Number of sampled spans started by this tracer | ||
SpansSampled metrics.Counter `metric:"spans" tags:"group=sampling,sampled=y"` | ||
|
||
// Number of not-sampled spans started by this tracer | ||
SpansNotSampled metrics.Counter `metric:"spans" tags:"group=sampling,sampled=n"` | ||
// Number of spans finished by this tracer | ||
SpansFinished metrics.Counter `metric:"finished_spans"` | ||
|
||
// Number of errors decoding tracing context | ||
DecodingErrors metrics.Counter `metric:"decoding-errors"` | ||
DecodingErrors metrics.Counter `metric:"span_context_decoding_errors"` | ||
|
||
// Number of spans successfully reported | ||
ReporterSuccess metrics.Counter `metric:"reporter-spans" tags:"state=success"` | ||
ReporterSuccess metrics.Counter `metric:"reporter_spans" tags:"result=ok"` | ||
|
||
// Number of spans in failed attempts to report | ||
ReporterFailure metrics.Counter `metric:"reporter-spans" tags:"state=failure"` | ||
// Number of spans not reported due to a Sender failure | ||
ReporterFailure metrics.Counter `metric:"reporter_spans" tags:"result=err"` | ||
|
||
// Number of spans dropped due to internal queue overflow | ||
ReporterDropped metrics.Counter `metric:"reporter-spans" tags:"state=dropped"` | ||
ReporterDropped metrics.Counter `metric:"reporter_spans" tags:"result=dropped"` | ||
|
||
// Current number of spans in the reporter queue | ||
ReporterQueueLength metrics.Gauge `metric:"reporter-queue"` | ||
ReporterQueueLength metrics.Gauge `metric:"reporter_queue_length"` | ||
|
||
// Number of times the Sampler succeeded to retrieve sampling strategy | ||
SamplerRetrieved metrics.Counter `metric:"sampler" tags:"state=retrieved"` | ||
SamplerRetrieved metrics.Counter `metric:"sampler_queries" tags:"result=ok"` | ||
|
||
// Number of times the Sampler failed to retrieve sampling strategy | ||
SamplerQueryFailure metrics.Counter `metric:"sampler_queries" tags:"result=err"` | ||
|
||
// Number of times the Sampler succeeded to retrieve and update sampling strategy | ||
SamplerUpdated metrics.Counter `metric:"sampler" tags:"state=updated"` | ||
SamplerUpdated metrics.Counter `metric:"sampler_updates" tags:"result=ok"` | ||
|
||
// Number of times the Sampler failed to update sampling strategy | ||
SamplerUpdateFailure metrics.Counter `metric:"sampler" tags:"state=failure,phase=updating"` | ||
|
||
// Number of times the Sampler failed to retrieve sampling strategy | ||
SamplerQueryFailure metrics.Counter `metric:"sampler" tags:"state=failure,phase=query"` | ||
SamplerUpdateFailure metrics.Counter `metric:"sampler_updates" tags:"result=err"` | ||
|
||
// Number of times baggage was successfully written or updated on spans. | ||
BaggageUpdateSuccess metrics.Counter `metric:"baggage-update" tags:"result=ok"` | ||
BaggageUpdateSuccess metrics.Counter `metric:"baggage_updates" tags:"result=ok"` | ||
|
||
// Number of times baggage failed to write or update on spans. | ||
BaggageUpdateFailure metrics.Counter `metric:"baggage-update" tags:"result=err"` | ||
BaggageUpdateFailure metrics.Counter `metric:"baggage_updates" tags:"result=err"` | ||
|
||
// Number of times baggage was truncated as per baggage restrictions. | ||
BaggageTruncate metrics.Counter `metric:"baggage-truncate"` | ||
BaggageTruncate metrics.Counter `metric:"baggage_truncations"` | ||
|
||
// Number of times baggage restrictions were successfully updated. | ||
BaggageRestrictionsUpdateSuccess metrics.Counter `metric:"baggage-restrictions-update" tags:"result=ok"` | ||
BaggageRestrictionsUpdateSuccess metrics.Counter `metric:"baggage_restrictions_updates" tags:"result=ok"` | ||
|
||
// Number of times baggage restrictions failed to update. | ||
BaggageRestrictionsUpdateFailure metrics.Counter `metric:"baggage-restrictions-update" tags:"result=err"` | ||
BaggageRestrictionsUpdateFailure metrics.Counter `metric:"baggage_restrictions_updates" tags:"result=err"` | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pavolloffay @objectiser penny for your thoughts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 - I assume the names will be consistent across all clients? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As much as possible. I don't think we have tag-based APIs in Python and Node.js clients. Another option would be to drop tags completely and just encode them in the name, e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to have tags - is there any reason they can't be added to python and node clients? |
||
|
||
// NewMetrics creates a new Metrics struct and initializes it. | ||
func NewMetrics(factory metrics.Factory, globalTags map[string]string) *Metrics { | ||
m := &Metrics{} | ||
// TODO the namespace "jaeger" should be configurable (e.g. in all-in-one "jaeger-client" would make more sense) | ||
metrics.Init(m, factory.Namespace("jaeger", nil), globalTags) | ||
return m | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package prometheus_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/stretchr/testify/require" | ||
jprom "github.com/uber/jaeger-lib/metrics/prometheus" | ||
|
||
"github.com/uber/jaeger-client-go" | ||
) | ||
|
||
// TestNewPrometheusMetrics ensures that the metrics do not have conflicting dimensions and will work with Prometheus. | ||
func TestNewPrometheusMetrics(t *testing.T) { | ||
tags := map[string]string{"lib": "jaeger"} | ||
|
||
factory := jprom.New(jprom.WithRegisterer(prometheus.NewPedanticRegistry())) | ||
m := jaeger.NewMetrics(factory, tags) | ||
|
||
require.NotNil(t, m.SpansStartedSampled, "counter not initialized") | ||
require.NotNil(t, m.ReporterQueueLength, "gauge not initialized") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should have a TODO to update documentation so that users are aware of https://github.com/jaegertracing/jaeger-client-go/blob/master/header.go#L30
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#223