Skip to content

Add enableContextPropagation field to Telemetry Tracing API#3645

Open
prashanthjos wants to merge 2 commits intoistio:masterfrom
prashanthjos:enable_trace_propogation
Open

Add enableContextPropagation field to Telemetry Tracing API#3645
prashanthjos wants to merge 2 commits intoistio:masterfrom
prashanthjos:enable_trace_propogation

Conversation

@prashanthjos
Copy link
Contributor

@prashanthjos prashanthjos commented Feb 3, 2026

Description

This PR adds a new enableContextPropagation field to the Telemetry API's Tracing configuration.

Problem

Currently, there is no way to disable trace context propagation without also disabling span reporting. Users who want to prevent trace headers from being forwarded to external services (e.g., at egress gateways) must use workarounds like:

  1. Setting disableSpanReporting: true (which loses observability)
  2. Using VirtualService header manipulation (which doesn't work when spans are still being reported)

Solution

Add enableContextPropagation (defaults to true) to the Tracing config. When set to false:

  • Trace context headers (X-B3-*, traceparent, tracestate, etc.) are not propagated in forwarded requests
  • Span reporting continues normally (unaffected)

Example Usage

apiVersion: telemetry.istio.io/v1
kind: Telemetry
metadata:
  name: egress-no-propagation
  namespace: istio-system
spec:
  selector:
    matchLabels:
      istio: egressgateway
  tracing:
  - enableContextPropagation: false

fixes #58871

Adds a new field `enable_context_propagation` to the Tracing message that allows users to disable trace context header propagation independently from span reporting.

This enables use cases like egress gateways where trace headers (X-B3-*, traceparent, etc.) should not be forwarded to external services while still maintaining internal observability.
@prashanthjos prashanthjos requested a review from a team as a code owner February 3, 2026 03:16
@istio-testing istio-testing added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 3, 2026
@istio-policy-bot
Copy link

🤔 🐛 You appear to be fixing a bug in Go code, yet your PR doesn't include updates to any test files. Did you forget to add a test?

Courtesy of your friendly test nag.

@istio-testing istio-testing added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 3, 2026
@zirain
Copy link
Member

zirain commented Feb 3, 2026

how would this work? can you elaborate?

@prashanthjos
Copy link
Contributor Author

prashanthjos commented Feb 3, 2026

@zirain this is my current thought process, do let me know if you see any issue:

Since Envoy's tracing providers don't have a native "disable propagation" option, the implementation in istiod would need to:

  1. Add EnableContextPropagation field to TracingSpec in pilot/pkg/model/telemetry.go

  2. When enableContextPropagation: false, add route-level request header removal for trace context headers before forwarding upstream:

    • X-B3-TraceId, X-B3-SpanId, X-B3-ParentSpanId, X-B3-Sampled, X-B3-Flags (Zipkin/B3)
    • traceparent, tracestate (W3C/OpenTelemetry)
    • Potentially x-request-id

This is similar to how VirtualService header manipulation works, but applied automatically based on the Telemetry config. Tracing remains enabled (spans are reported), but the headers are stripped before the request leaves the proxy. I will dive deeper once I get to implementation.

@zirain
Copy link
Member

zirain commented Feb 3, 2026

so that means a Telemetry API will affect route?

@prashanthjos
Copy link
Contributor Author

Yes, the Telemetry API would affect route configuration when enableContextPropagation: false. ( I will get better idea once I start coding the changes, but this is the idea for now)

Since Envoy's tracing providers don't have a native "disable propagation only" option (they always propagate headers when tracing is enabled), the implementation would need to add request header removal to the route config to strip trace context headers before forwarding upstream.

This is similar to how:

  • disableSpanReporting affects whether tracing is configured at all
  • Access logging Telemetry config affects listener/HCM filters

The Telemetry API already influences multiple parts of Envoy config (HCM tracing, filters, etc.). This would extend that to route-level header manipulation when context propagation needs to be disabled.

@zirain
Copy link
Member

zirain commented Feb 3, 2026

They wouldn't change the route, accesslog is a part of HCM.

Then I would like to say no to this API, recommand to add tips on istio.io before envoy support native dsiable context propagtion base on the tracing provider.

@prashanthjos
Copy link
Contributor Author

@zirain are you suggesting changes to envoy, before making Istio changes?

@zirain
Copy link
Member

zirain commented Feb 3, 2026

@zirain are you suggesting changes to envoy, before making Istio changes?

Yes, that's what I thought.

@prashanthjos
Copy link
Contributor Author

I understand, let me see if I can try making changes to envoy before moving forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants