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

feat(metrics): add MetricProducer support (fixes #4768)

Open Prhmma opened this issue 2 months ago • 1 comments

Description

Introduces a MetricProducer interface and integrates the producer collection into MetricReader.collect, enabling the Python SDK to ingest metrics from third-party sources. Adds supporting tests, documentation, and examples.

Fixes #4768

Type of change

Please delete options that are not relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [X] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

tox -e py310-test-opentelemetry-sdk -- -k "MetricProducer" -vv (uses uv to provision; passes MetricProducer suite, with the known benign Windows teardown AttributeError in TestLoggingInit.test_dictConfig_preserves_otel_handler)

Does This PR Require a Contrib Repo Change?

  • [ ] Yes. - Link to PR:
  • [X] No.

Checklist:

  • [X] Followed the style guidelines of this project
  • [ ] Changelogs have been updated
  • [X] Unit tests have been added
  • [X] Documentation has been updated

Prhmma avatar Oct 10 '25 21:10 Prhmma

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: Prhmma / name: Parham (b66924f4c0f7577d0e0a41ec888787c60e335391)