feat(config): add metric producer support to declarative config
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
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
MetricProducerfrom the config - Pass the resolved list as
metric_producers=[...]to eachMetricReaderconstructor 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.
We don't actually even have an implementation of MetricProducer in the SDK, that would probably be the starting point.
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.)