Skip to content

feat(propagation): decouple propagation module from config and make it public#176

Merged
duncanista merged 3 commits intomainfrom
jordan.gonzalez/propagation/abstract-from-config
Mar 9, 2026
Merged

feat(propagation): decouple propagation module from config and make it public#176
duncanista merged 3 commits intomainfrom
jordan.gonzalez/propagation/abstract-from-config

Conversation

@duncanista
Copy link
Contributor

What does this PR do?

Decouples the propagation module from the concrete Config struct by introducing a PropagationConfig trait. This makes DatadogCompositePropagator generic over any configuration type that implements the trait, and exports the propagation module unconditionally (previously
gated behind test-utils).

Changes:

  • Add PropagationConfig trait with the 5 methods needed by propagators
  • Make DatadogCompositePropagator<C: PropagationConfig> generic for zero-cost monomorphization
  • Implement PropagationConfig for Config to maintain full backward compatibility
  • Make propagation module unconditionally pub (was pub only under test-utils, pub(crate) otherwise)
  • Re-export TracePropagationStyle from the propagation module

Motivation

External consumers like the Lambda extension (bottlecap) have their own propagation code that duplicates what lives here. By decoupling propagation from the full Config struct (which carries 70+ fields and heavy dependencies), external crates can depend on
datadog-opentelemetry for propagation by implementing the lightweight PropagationConfig trait on their own config type — without pulling in the entire tracer configuration.

Additional Notes

  • All 285 existing propagation tests pass without modification (beyond adding the now-needed Config import in test modules).
  • The Propagator trait remains pub(crate) — only PropagationConfig, DatadogCompositePropagator, and the context/carrier types are public.
  • Uses generics (impl PropagationConfig) rather than dyn PropagationConfig since propagation is on the hot path (called every Lambda invocation).
  • A follow-up PR in bottlecap will add datadog-opentelemetry as a dependency and replace its local propagation code.

…onfig trait

Introduce a `PropagationConfig` trait that abstracts the 5 configuration
fields needed by propagators, allowing external consumers (e.g. Lambda
extension) to reuse the propagation module without depending on the full
`Config` struct.

- Make `propagation` module unconditionally public (was gated behind
  `test-utils` feature)
- Add `PropagationConfig` trait with methods for propagation styles,
  extract-first behavior, and tags max length
- Make `DatadogCompositePropagator` generic over `C: PropagationConfig`
  for zero-cost monomorphization
- Implement `PropagationConfig` for `Config` to maintain backward
  compatibility
- Re-export `TracePropagationStyle` from the propagation module
@duncanista duncanista requested a review from a team as a code owner March 6, 2026 21:37
@duncanista duncanista changed the title feat(propagation): feat(propagation): decouple propagation module from config and make it public Mar 6, 2026
Copy link
Collaborator

@iunanua iunanua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM

@duncanista duncanista enabled auto-merge (squash) March 9, 2026 16:31
@duncanista duncanista merged commit 6bf3719 into main Mar 9, 2026
26 checks passed
@duncanista duncanista deleted the jordan.gonzalez/propagation/abstract-from-config branch March 9, 2026 16:42
Dogbu-cyber added a commit that referenced this pull request Mar 12, 2026
Upstream changes from #176 and #177: make the propagation module public,
decouple it from the full Config struct via a PropagationConfig trait,
and export header key constants for use by downstream crates.
Dogbu-cyber added a commit that referenced this pull request Mar 12, 2026
Upstream changes from #176 and #177: make the propagation module public,
decouple it from Config via a PropagationConfig trait, and export header
key constants for use by downstream crates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants