opentelemetry-python icon indicating copy to clipboard operation
opentelemetry-python copied to clipboard

feat(config): add metric producer support to declarative config

Open MikeGoldsmith opened this issue 7 months ago • 3 comments

The declarative config MeterProvider implementation does not currently handle metric producers (MetricProducer). This component type is listed in the OTel declarative config spec as a supported plugin component but is not implemented in _meter_provider.py.

Related: #3631

MikeGoldsmith avatar Apr 09 '26 17:04 MikeGoldsmith

Hi, I'd like to work on this if it's available.

My plan:

  • Follow the entry-point loading pattern being established in #5053 to instantiate each MetricProducer from the config
  • Pass the resolved list as metric_producers=[...] to each MetricReader constructor in _meter_provider.py
  • Add tests mirroring the existing patterns in tests/_configuration/test_meter_provider.py

One question before I start: should metric_producers be loaded exclusively via entry points (consistent with #5053), or is there also a need to handle known built-in producers (e.g. Prometheus) with a direct import path similar to how OTLP exporters are handled?

Happy to wait until #5053 lands if the entry-point infrastructure isn't ready yet.

ravitheja4531-cell avatar Apr 10 '26 14:04 ravitheja4531-cell

We don't actually even have an implementation of MetricProducer in the SDK, that would probably be the starting point.

aabmass avatar May 12 '26 03:05 aabmass

Reopening — this was closed in error. The actual implementation work (adding MetricProducer plumbing to the SDK _meter_provider.py) hasn't been done. The pull metric reader work that did land (PR #5216) belongs to #5074, not this issue.

(Per @aabmass's earlier comment, the SDK doesn't yet have a MetricProducer base class — that's the actual starting point for this work.)

MikeGoldsmith avatar Jun 03 '26 16:06 MikeGoldsmith