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

Allow overriding scope and tags separator #20

Merged
merged 2 commits into from
Jul 17, 2017

Conversation

yurishkuro
Copy link
Member

Prometheus does not allow '-' or '.' in metric names.

Cf: https://github.com/uber/jaeger/issues/273

Prometheus does not allow '-' or '.' in metric names.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling c22a889 on prometheus-metric-names into 1321951 on master.

yurishkuro pushed a commit to jaegertracing/jaeger that referenced this pull request Jul 16, 2017
Defaults to expvar. Prometheus metrics currently don't work because
it does not allow dots in the names (jaegertracing/jaeger-lib#20)
and requires pre-declaring all tag keys, which is not supported by
the Jaeger's metrics API.
@@ -90,6 +111,7 @@ func (f *factory) nameAndTagsList(nom string, tags map[string]string) (name stri

func (f *factory) Counter(name string, tags map[string]string) metrics.Counter {
name, tagsList := f.nameAndTagsList(name, tags)
println(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope

hist.Observe(10.5)
m := findMetric(t, "namespace_subsystem_gokit_prom_hist")
require.NotNil(t, m)
assert.Equal(t, 10.5, m[0].GetHistogram().GetSampleSum())
}

func TestWrapper(t *testing.T) {
f := NewFactory("", "", nil)
wf := xkit.Wrap("foo", f, xkit.ScopeSeparator(":"))
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like whoever uses prometheus has to remember to add the scope and tags separator FactoryOption to xkit because it currently defaults to '.' and if they forget everything blows up? Scary.

Copy link
Member Author

Choose a reason for hiding this comment

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

it's a good point. I think we should design this differently. In practice nobody cares that prometheus factory is creates via xkit.Wrap, so I think a better design would be

metrics/
    api files
    go-kit/
       the wrapper thing
    prometheus/
       something that uses go-kit wrapper but actually returns the real metrics.Factory

this way the constructor for prometheus can specify its separators

Copy link
Member Author

Choose a reason for hiding this comment

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

a thing for a separate PR, however

yurishkuro pushed a commit to jaegertracing/jaeger that referenced this pull request Jul 17, 2017
Defaults to expvar. Prometheus metrics currently don't work because
it does not allow dots in the names (jaegertracing/jaeger-lib#20)
and requires pre-declaring all tag keys, which is not supported by
the Jaeger's metrics API.
yurishkuro added a commit to jaegertracing/jaeger that referenced this pull request Jul 17, 2017
Defaults to expvar. Prometheus metrics currently don't work because
it does not allow dots in the names (jaegertracing/jaeger-lib#20)
and requires pre-declaring all tag keys, which is not supported by
the Jaeger's metrics API.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 885c497 on prometheus-metric-names into 1321951 on master.

@yurishkuro yurishkuro merged commit 575c678 into master Jul 17, 2017
@yurishkuro yurishkuro deleted the prometheus-metric-names branch July 17, 2017 23:00
ideepika pushed a commit to ideepika/jaeger that referenced this pull request Oct 22, 2017
Defaults to expvar. Prometheus metrics currently don't work because
it does not allow dots in the names (jaegertracing/jaeger-lib#20)
and requires pre-declaring all tag keys, which is not supported by
the Jaeger's metrics API.
liontwinkle added a commit to liontwinkle/go-jeager that referenced this pull request Aug 1, 2020
Defaults to expvar. Prometheus metrics currently don't work because
it does not allow dots in the names (jaegertracing/jaeger-lib#20)
and requires pre-declaring all tag keys, which is not supported by
the Jaeger's metrics API.
outdoorSpirit added a commit to outdoorSpirit/Go-Jag that referenced this pull request May 3, 2024
Defaults to expvar. Prometheus metrics currently don't work because
it does not allow dots in the names (jaegertracing/jaeger-lib#20)
and requires pre-declaring all tag keys, which is not supported by
the Jaeger's metrics API.
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.

None yet

3 participants