Skip to content

feat(config): add shared load_entry_point utility for declarative config plugin loading#5093

Open
MikeGoldsmith wants to merge 3 commits intoopen-telemetry:mainfrom
MikeGoldsmith:mike/config-plugin-load-util
Open

feat(config): add shared load_entry_point utility for declarative config plugin loading#5093
MikeGoldsmith wants to merge 3 commits intoopen-telemetry:mainfrom
MikeGoldsmith:mike/config-plugin-load-util

Conversation

@MikeGoldsmith
Copy link
Copy Markdown
Member

Description

Adds a shared load_entry_point(group, name) helper to _common.py for loading plugins via entry points in declarative file configuration. Refactors _propagator.py to use it, removing the duplicated inline implementation.

This utility will be used by upcoming PRs for generic plugin loading support:

cc @ravitheja4531-cell — this utility is intended to support your work on #5053. Rather than implementing the entry point lookup inline, you can use load_entry_point("opentelemetry_resource_detector", name) from _common and it will handle the error wrapping for you.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Added TestLoadEntryPoint tests in test_common.py covering: successful load, not-found error, and load exception wrapping
  • Updated test_propagator.py patch targets to reflect the moved entry_points import
  • All existing propagator tests pass unchanged

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

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

Extracts a generic `load_entry_point(group, name)` helper into `_common`
so that resource detector, exporter, propagator, and sampler plugin loading
in declarative file config can all use the same entry point lookup pattern
rather than duplicating it.

Refactors `_propagator.py` to use the new util, removing its inline
entry point lookup.

Assisted-by: Claude Sonnet 4.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Easy to review / merge / close

Development

Successfully merging this pull request may close these issues.

1 participant