open-telemetry / opentelemetry-specification

Specifications for OpenTelemetry
https://opentelemetry.io
Apache License 2.0
3.65k stars 873 forks source link

Schema transformations should be able to convert metric units #3729

Open pyohannes opened 8 months ago

pyohannes commented 8 months ago

What are you trying to achieve?

Recently the default unit for duration metrics was changed from milliseconds to seconds. This resulted (and will result) in breaking changes to existing metrics semantic conventions. Some related PRs/issues:

This change could be covered by automatic schema transformations by specifying the metric name, the old unit, the new unit, and a conversion factor.

Such a schema transformation would help telemetry consumers to mitigate the pain of such breaking changes, as data points from a metric from different versions of semantic conventions with different units could be aggregated into the same metric. This can help avoid severe disruptions for telemetry consumers.

Furthermore, the possibility of covering such changes by schema transformations gives more flexibility to semantic conventions authors, as without such a mechanism changing units for stable metrics would be impossible.

tigrannajaryan commented 8 months ago

I support this. Any transformation that we notice happens often in semconv and is possible to process in a stateless manner by just looking at an individual metric data point should be a candidate for becoming a supported transform in the Schema file.

tigrannajaryan commented 2 months ago

We need more community feedback and use cases to decide on the priority of this.