Prefixes on OpenTelemetry metric names
- Dominant language
- Go
- Stars
- 1.3k
- Forks
- 543
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 109
Description
If you use apm-server to collect OpenTelemetry metrics today, for example:
https://github.com/matschaffer/elastic-otel-metrics/blob/dfa52024bc9536c2ed6ce13fe415c61aa5b396da/src/server/index.ts#L73-L75
The metric name gets used as a root key on the document. So in the above case you'd get a `rule_successes` field on the `metrics-apm.app.elastic-otel-metrics-default` data stream.
For larger applications (like kibana) this creates a high potential of collision. For example two plugins in the same app might publish different `duration` meters. Perhaps one is a gauge and one is a histogram, creating a mapping conflict.
I asked about this on the [CNCF slack](https://cloud-native.slack.com/archives/C01NL1GRPQR/p1654692501783539?thread_ts=1654664632.413549&cid=C01NL1GRPQR) and the advices was that the meter name (`example-meter` in the above example) should be available to the OTLP consumer for use as a prefix.
If we prefixed the instrument name with the meter name, we'd only have to insure that two plugins within the same service had unique instrumentation names within a single meter. As long as meter names are unique, we'd avoid the possibility of conflict.
So in the above example `rule_successes` would become `example-meter.rule_successes`.
Contributor guide
Assessment
This issue has not been assessed yet.