Stabilize Prometheus Exporter: Scope Info
As part of the initiative to stabilize the Prometheus Exporter spec, the Python SDK's Prometheus Exporter should introduce support for Scope Info configuration to align with the spec.
The current implementation status is documented in https://github.com/open-telemetry/opentelemetry-specification/issues/4989#issuecomment-4214459250.
Hi, I'd like to work on this issue.
The spec (sdk_exporters/prometheus.md) defines a without_scope_info option (MAY, default false)
to suppress both the otel_scope_info info metric and the otel_scope_name/otel_scope_version
labels on data metrics. The Python exporter already has a without_target_info parameter — I'd
implement without_scope_info following the same pattern.
Planned changes:
- Add
without_scope_info: bool = FalsetoPrometheusMetricReader.__init__ - Propagate it into
_CustomCollectorto gate both theotel_scope_infometric and scope labels - Add tests mirroring the existing
without_target_infotest cases
Happy to proceed if this approach looks good to maintainers. Note that spec issue #4989 is still in "Discussion Needed" — should I wait for that to land first, or is implementing the current draft wording acceptable?
Thank you for offering your help @ravitheja4531-cell! It looks like there already is an open PR by @herin049 that will close this issue: https://github.com/open-telemetry/opentelemetry-python/pull/5123.