feat(traces): migrate trace propagation to dd-trace-rs#1089
feat(traces): migrate trace propagation to dd-trace-rs#1089duncanista wants to merge 7 commits intomainfrom
Conversation
Replace local trace extraction/propagation implementation with datadog-opentelemetry crate from dd-trace-rs. This removes maintenance burden for Datadog/TraceContext propagator logic. - Add datadog-opentelemetry dependency - Remove local propagation modules (context, error, text_map_propagator) - Use DatadogCompositePropagator from dd-trace-rs with thin wrapper for ot-baggage-* header extraction (not yet supported upstream) - Update all consumers to import directly from datadog-opentelemetry - Adapt to u128 trace_id, Sampling struct, SamplingPriority types
|
Merge needs to be held until dd-trace-rs changes are on main or released |
…ace IDs The truncation is intentional — Datadog protocol transmits the lower 64 bits via x-datadog-trace-id, with upper bits in _dd.p.tid tag.
There was a problem hiding this comment.
Pull request overview
This PR migrates trace context propagation from Bottlecap’s local implementation to datadog-opentelemetry (from dd-trace-rs), removing local Datadog/W3C propagation code while keeping a small wrapper to support ot-baggage-* extraction.
Changes:
- Add
datadog-opentelemetrydependency and adapt config to satisfy its propagation configuration trait. - Remove local propagation/context modules and update call sites to use upstream
SpanContext,Sampling,TracePropagationStyle, and header constants. - Keep a thin
DatadogCompositePropagatorwrapper to addot-baggage-*extraction not supported upstream yet.
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| bottlecap/src/traces/propagation/text_map_propagator.rs | Deleted local header/W3C TraceContext propagators and tests. |
| bottlecap/src/traces/propagation/error.rs | Deleted local propagation error type. |
| bottlecap/src/traces/context.rs | Deleted local SpanContext/Sampling types in favor of upstream. |
| bottlecap/src/traces/mod.rs | Removes context module export now that it’s deleted. |
| bottlecap/src/traces/propagation/mod.rs | Replaces local multi-propagator logic with wrapper around upstream composite + baggage extraction. |
| bottlecap/src/traces/propagation/carrier.rs | Switches carrier traits to upstream and introduces JsonCarrier newtypes for serde_json::Value. |
| bottlecap/src/otlp/transform.rs | Imports Datadog trace-id-high constant from upstream. |
| bottlecap/src/lifecycle/listener.rs | Updates injected headers to use upstream context/constants and u128 trace IDs. |
| bottlecap/src/lifecycle/invocation/processor.rs | Updates extraction to use upstream propagator and JSON carriers; adjusts for u128 trace IDs. |
| bottlecap/src/lifecycle/invocation/processor_service.rs | Updates SpanContext import to upstream. |
| bottlecap/src/lifecycle/invocation/span_inferrer.rs | Replaces local propagator trait usage with DatadogCompositePropagator. |
| bottlecap/src/lifecycle/invocation/context.rs | Switches to upstream SpanContext. |
| bottlecap/src/lifecycle/invocation/triggers/step_function_event.rs | Updates to upstream SpanContext/Sampling and adds local _dd.p.* parsing helper. |
| bottlecap/src/lifecycle/invocation/triggers/sqs_event.rs | Updates to upstream SpanContext/Sampling and u128 trace IDs. |
| bottlecap/src/config/trace_propagation_style.rs | Uses upstream TracePropagationStyle and keeps only deserialization logic. |
| bottlecap/src/config/mod.rs | Implements upstream PropagationConfig for Config; updates tests to match supported styles. |
| bottlecap/src/config/env.rs | Adjusts env parsing tests/defaults to supported upstream style names. |
| bottlecap/src/config/yaml.rs | Adjusts YAML sample/tests to supported upstream style names. |
| bottlecap/Cargo.toml | Adds git dependency on datadog-opentelemetry. |
| bottlecap/Cargo.lock | Updates lockfile with new dependency tree introduced by datadog-opentelemetry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
bottlecap/src/lifecycle/invocation/triggers/step_function_event.rs
Outdated
Show resolved
Hide resolved
|
What prompted this? Is this just some code cleanup? |
Any change to the extension size? |
- Deduplicate extract_propagation_tags into shared helper in traces::propagation - Use case-insensitive matching for ot-baggage-* header prefix - Update datadog-opentelemetry to f51cefc
Leftover static fixtures from the old propagation tests were triggering dead_code warnings with --all-targets.
|
@jchrostek-dd just cleanup, there's a ticket around there |
Overview
Migrate trace context propagation from a local implementation to the datadog-opentelemetry crate in dd-trace-rs. This removes ~750 lines of propagation logic (Datadog headers, W3C TraceContext) that we were maintaining locally in favor of the shared upstream
implementation.
Key changes:
Motivation
Not have to own this piece as its tracer logic and SVLS-7466
Testing