beam-telemetry/telemetry_metrics

Use atom list instead of binary with dots as a metric names

hauleth opened this issue · 4 comments

This is IMHO much more "natural" way as not all backends uses dots.

Notable dot users:

  • StatsD (and DataDog)
  • Graphite
  • Riemman
  • Splunk
  • Wavefront (allows other separators, but use dots as default)

Notable non dot users:

  • Prometheus (underscore)
  • InfluxDB (underscore)
  • Carbon2 (not specified, do not use "metric names" at all)
  • Dropwizard (if I understand correctly the specs, they do not use any separator, or leave it up to the storage tool)
  • OpenCensus (slash, by convention)

Not sure:

  • collectd

Not defined/mixed:

  • OpenTelemetry do not (yet?) defines metrics separator. Currently only few tags and spans have defined names and in that case both dots and underscores are used.

So while dot seems like popular format, it is not used everywhere, and in my personal opinion it needlessly diverges from the Telemetry approach of defining metrics as a list of atoms. Current naming approach feel very StatsD centric for me.

I feel that the more "natural" way of defining metrics (at least in my opinion) would be:

Telemetry.Metrics.metric_type(metric_group, metric_name, options)

For example

Telemetry.Metrics.distribution([:http, :requests, :stop], :duration, buckets: [100, 200, 300])

Instead of

Telemetry.Metrics.distribution("http.request.stop.duration", buckets: [100, 200, 300])

cc @bryannaegele as he is maintainer of Prometheus integration which uses different separator than dot.

@josevalim I know it is a sugar and that internally it is list of atoms. My point is that we should not have sugar in library basic as this one. TBH sometimes I have feeling that Elixir community fallback to sugar too early and without good reason.

I am not really interested in having this discussion right now. I think it is justified and doesn’t pose any confusion, feel free to disagree. So you are welcome to send a PR or I will be glad to keep things as is too.