Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default metrics namespace separator from colon to underscore #43

Merged
merged 1 commit into from
Apr 25, 2018

Conversation

jpkrohling
Copy link
Contributor

Signed-off-by: Juraci Paixão Kröhling juraci@kroehling.de

@jpkrohling
Copy link
Contributor Author

This is required by jaegertracing/jaeger#776

@codecov
Copy link

codecov bot commented Apr 19, 2018

Codecov Report

Merging #43 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #43   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          25     25           
  Lines         710    719    +9     
=====================================
+ Hits          710    719    +9
Impacted Files Coverage Δ
metrics/local.go 100% <100%> (ø) ⬆️
metrics/prometheus/factory.go 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5ea3ab...631dd05. Read the comment docs.

@jpkrohling
Copy link
Contributor Author

I'm marking this as a WIP until jaegertracing/jaeger#776 is reviewed.

@jpkrohling
Copy link
Contributor Author

@yurishkuro I remember discussing this PR last Friday, but don't remember the outcome: is this PR OK as it is?

@jpkrohling jpkrohling force-pushed the 732-MetricNames branch 3 times, most recently from 922bd0d to 0fd7921 Compare April 23, 2018 10:36
"my-counter": 6,
"other-counter": 8,
"namespace.my-counter|x=y": 7,
"ns.subns|service=a-service": 9,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current master would return this metric as ns.subns.|service=a-service (extra dot at the end, before the |)


if name == "" {
return l.namespace
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

NB: this kind of code is repeated several times in this library, it could use some refactoring.

@@ -184,7 +184,7 @@ func (f *Factory) subScope(name string) string {
if name == "" {
return f.normalize(f.scope)
}
return f.normalize(f.scope + ":" + name)
return f.normalize(f.scope + "_" + name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpkrohling we had an internal discussion, the proposal is that instead of hardcoding this separator we make it an option to the factory (since it already supports options). Then in jaeger we default to _ (without bothering to make it a cli switch), but in jaeger-client-go people can, if necessary, instantiate the factory with : as before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just updated the PR to include this suggestion. I decided to use a rune for the separator, as I think a single char should suffice, but let me know if a string would be more suitable.

@@ -57,6 +59,14 @@ func WithBuckets(buckets []float64) Option {
}
}

// WithSeparator returns an option that sets the default separator for the namespace
// If not used, we fallback to underscore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • nit: end sentences with dots.
  • underscore and colon are the only valid choices for a separator for Prometheus. Given that, another option would be to use an enum (which is better than simply documenting valid values).
type Separator rune
const (
    SeparatorUnderscore rune = '_'
    SeparatorColon           = ':'
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the type of SeparatorUnderscore is Separator instead of rune?

@jpkrohling jpkrohling force-pushed the 732-MetricNames branch 2 times, most recently from 845576f to 9f8c612 Compare April 25, 2018 04:33
@jpkrohling
Copy link
Contributor Author

The commits have been squashed and the PR updated with the latest suggestion (enum for separator values)

Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
@jpkrohling jpkrohling changed the title WIP - Change metrics naming scheme Change metrics naming scheme Apr 25, 2018
@yurishkuro yurishkuro merged commit fe748a2 into jaegertracing:master Apr 25, 2018
@yurishkuro yurishkuro changed the title Change metrics naming scheme Change default metrics namespace separator from colon to underscore May 11, 2018
@yurishkuro
Copy link
Member

@jpkrohling released as 1.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants