Handle conflicting metric descriptions and types in prometheus exporter #2869
Labels
area:sdk
Related to the SDK
[label deprecated] triaged-accepted
[label deprecated] Issue triaged and accepted by OTel community, can proceed with creating a PR
spec:metrics
Related to the specification/metrics directory
With #2703 instrumentation scope name and version are included as attributes in the prometheus exporter, which helps to accommodate OpenTelemetry metric's ability to have instruments with the same name under different scopes.
However, these instruments can still have conflicting types and descriptions, which present problems in prometheus scrapers as discussed in open-telemetry/opentelemetry-java#4834.
The following scenario illustrates the problem:
scope1
, instrument name:my_instrument
, instrument type:counter
, description:description1
scope2
, instrument name:my_instrument
, instrument type:gauge
, description:description2
As of #2703, this will be serialized in the prometheus exporter as follows:
One possible solution is to detect conflicting descriptions / types in the prometheus exporter and log an error and / or skip the offending metric. Views can be used to change the name of one of the offending instruments to avoid the conflict.
The text was updated successfully, but these errors were encountered: