Conversation
| // 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. |
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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?
Closes #411 — I hope!