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

metrics: improve README #417

Merged
merged 2 commits into from
Dec 18, 2016
Merged

metrics: improve README #417

merged 2 commits into from
Dec 18, 2016

Conversation

peterbourgon
Copy link
Member

Closes #411 — I hope!

@peterbourgon peterbourgon merged commit 71c13b6 into master Dec 18, 2016
@peterbourgon peterbourgon deleted the improve-metrics-documentation branch December 18, 2016 13:43
// backends. Each metric has an observation method (Add, Set, or Observe,
// respectively) used to record values, and a With method to "scope" the
// observation by various parameters. For example, you might have a Histogram to
// record request durations, parameterized by the method that's being called.
Copy link
Contributor

@willfaught willfaught Dec 19, 2016

Choose a reason for hiding this comment

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

I think it's useful to note that for impls that support With, the semantics are different for instantiating them than for those that don't. For example, for Prometheus, you'd do something like NewPrometheusCounter("request_duration").With("foo_service").With("bar_endpoint"), whereas for Statsd you'd do something like NewStatsdCounter("foo_service_bar_endpoint_request_duration") (since With is useless for distinguishing metrics in that case). At least, that's my limited understanding; correct me if I'm wrong.

Something like "Note that for implementations that do not support With, the full metric name and context must be provided when creating the instance, not using With"?

Copy link
Contributor

Choose a reason for hiding this comment

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

The label names seem to be implementation-dependent as well (please correct me if I'm wrong!). It seems, IIUC, that for Prometheus, you should use underscores as separators, whereas for Statsd you should use periods. I imagine it's possible for another implementation that actually uses With to expect periods too. So for gokit, the label value format for With is implementation-specific, even though the interfaces are supposed to abstract away those details. Kinda defeats the purpose of the interfaces, IMO. Maybe the With impls should accept a common format and transform it if necessary to the underlying impl's format?

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.

2 participants