feat(config): propagator plugin loading via entry points for declarative config#5098
Open
MikeGoldsmith wants to merge 3 commits intoopen-telemetry:mainfrom
Open
Conversation
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
Assisted-by: Claude Sonnet 4.6
TextMapPropagator is changed from @DataClass to TypeAlias = dict[str, Any] in models.py, preserving unknown propagator names (plugin names) as dict keys through the config pipeline — same approach as Sampler. _propagators_from_textmap_config() now iterates the dict's key-value pairs directly. Known names (tracecontext, baggage) are bootstrapped from _PROPAGATOR_REGISTRY. All other names — including b3, b3multi, and custom plugin propagators — fall back to load_entry_point("opentelemetry_propagator", name), matching the spec's PluginComponentProvider mechanism. Assisted-by: Claude Sonnet 4.6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Extends propagator support in declarative file configuration to handle custom (plugin) propagators in the
compositelist, matching the spec's PluginComponentProvider mechanism.Solution
TextMapPropagatoris changed from@dataclasstoTypeAlias = dict[str, Any]inmodels.py, preserving unknown propagator names as dict keys — the same approach used forSamplerin #5095._propagators_from_textmap_config()now iterates the dict's key-value pairs directly via_PROPAGATOR_REGISTRY:tracecontext,baggage) are bootstrapped directly from the SDKb3,b3multi, and custom plugin propagators — fall back toload_entry_point("opentelemetry_propagator", name)Custom propagator example
Closes #5070