Skip to content

feat(epp): complete W3C trace propagation for OpenTelemetry export - #2702

Open
dayakar349 wants to merge 1 commit into
llm-d:mainfrom
dayakar349:rhoaieng-83714-epp-trace-propagation
Open

feat(epp): complete W3C trace propagation for OpenTelemetry export#2702
dayakar349 wants to merge 1 commit into
llm-d:mainfrom
dayakar349:rhoaieng-83714-epp-trace-propagation

Conversation

@dayakar349

Copy link
Copy Markdown

What type of PR is this?

/kind feature
What this PR does / why we need it:
Completes W3C trace propagation for RHOAIENG-83714 (US-02) on the Endpoint Picker and P/D sidecar.

  • Treat traceparent, tracestate, and baggage as system-owned headers so client values are not re-forwarded after generateHeaders injects the active span context.
  • Add InitTextMapPropagator() and call it at EPP and P/D sidecar startup so extract/inject work when OTLP export is disabled.
  • Add unit and hermetic integration tests for propagation header handling and downstream trace injection.
    With --tracing=true and standard OTEL_* env vars, EPP joins upstream traces, records routing spans, injects a single updated traceparent for downstream workloads, and exports spans to the platform collector.

Test plan

  • make presubmit with CONTAINER_RUNTIME=podman
  • Unit tests for W3C trace header propagation and InitTextMapPropagator startup
  • Hermetic integration: single downstream traceparent after span injection
  • Manual cluster (test-epp-scrape): --tracing=true, OTLP export, ext_proc path, Tempo traces for llm-d-epp

Which issue(s) this PR fixes:

Related to RHOAIENG-83714
Fixes #

Release note (write NONE if no user-facing change):

When OpenTelemetry tracing is enabled on the Endpoint Picker, W3C trace context is propagated to downstream inference workloads with a single updated traceparent header.

@dayakar349
dayakar349 requested review from a team, roytman and zetxqx as code owners September 4, 2026 21:25
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🚨 Unsigned commits detected! Please sign your commits.

For instructions on how to set up GPG/SSH signing and verify your commits, please see GitHub Documentation.

@github-actions github-actions Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/sidecar area/epp area/telemetry labels Sep 4, 2026
Comment thread cmd/pd-sidecar/main.go
Comment on lines +56 to 60
tracing.InitTextMapPropagator()

// Initialize tracing conditionally using config
if opts.Tracing {
shutdown, err := tracing.InitTracing(ctx, logger, "llm-d-disagg-sidecar")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Question: should this be behind the same if opts.Tracing gate as InitTracing or is the current unconditional InitTextMapPropegator what we want?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Unconditional is intentional. Propagation needs to work when --tracing=false so EPP can still read and forward upstream traceparent headers. Gating it behind opts.Tracing would only enable that when OTLP export is on.

Comment thread cmd/epp/runner/runner.go
Comment on lines +244 to 247
tracing.InitTextMapPropagator()

if opts.Tracing {
shutdown, err := tracing.InitTracing(ctx, setupLog, "llm-d-epp")

@cgoodfred cgoodfred Sep 8, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Question: should this be behind the same if opts.Tracing gate as InitTracing or is the current unconditional InitTextMapPropegator what we want?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Unconditional is intentional. Propagation needs to work when --tracing=false so EPP can still read and forward upstream traceparent headers. Gating it behind opts.Tracing would only enable that when OTLP export is on.

tracerProvider := sdktrace.NewTracerProvider(opt...)
otel.SetTracerProvider(tracerProvider)
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))
InitTextMapPropagator()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Question: in pd-sidecar/main.go and epp/runner/runner.go there is a direct call to InitTextPropagator then have a conditional that calls tracing.InitTracing which now also includes InitTextMapPropagator. Whats the reason for the duplication and is it necessary?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The startup call covers the tracing-off path. InitTracing() calls it again when tracing is on, so there is duplication on that path. It is idempotent. I can remove the call from InitTracing() and keep only the startup init if you prefer.

@dayakar349
dayakar349 force-pushed the rhoaieng-83714-epp-trace-propagation branch from f8043bb to 0f9de8a Compare September 8, 2026 16:57
@ahg-g

ahg-g commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

/assign @gyliu513

@dayakar349
dayakar349 force-pushed the rhoaieng-83714-epp-trace-propagation branch from 0f9de8a to 970fb27 Compare September 9, 2026 14:46
US-02 (RHOAIENG-83714): finish W3C trace propagation on the Endpoint Picker.
- Treat traceparent, tracestate, and baggage as system-owned headers so client
  values are not re-forwarded after generateHeaders injects the active span.
- Add InitTextMapPropagator and call it at EPP and P/D sidecar startup so
  extract/inject work when OTLP export is disabled.
- Add unit and hermetic integration coverage for propagation and injection.

Signed-off-by: Dayakar Maruboena <dmaruboe@dmaruboe-thinkpadp1gen7.rht.csb>
Signed-off-by: Dayakar Maruboena <dmaruboe@redhat.com>
@dayakar349
dayakar349 force-pushed the rhoaieng-83714-epp-trace-propagation branch from 970fb27 to 7a2136c Compare September 9, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/epp area/observability area/sidecar area/telemetry size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants