Add disableContextPropagation field to Telemetry Tracing API#3645
Add disableContextPropagation field to Telemetry Tracing API#3645istio-testing merged 4 commits intoistio:masterfrom
Conversation
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.
|
how would this work? can you elaborate? |
|
@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:
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. |
|
so that means a Telemetry API will affect route? |
|
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:
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. |
|
They wouldn't change the Then I would like to say |
|
@zirain are you suggesting changes to envoy, before making Istio changes? |
Yes, that's what I thought. |
|
I understand, let me see if I can try making changes to envoy before moving forward. |
|
@zirain the PR has been approved by Envoy, we now have |
|
@zirain looks like your approval is not merging the PR, how can we get this merged :) |
|
we need a TOC approve. |
|
@ramaraochavali @keithmattix @therealmitchconnors can you please help |
|
🤔 🐛 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. |
telemetry/v1alpha1/telemetry.proto
Outdated
| // to external services while still reporting spans for internal observability. | ||
| // Defaults to true (context propagation enabled). | ||
| // NOTE: This does NOT impact span reporting; use `disable_span_reporting` to control that. | ||
| google.protobuf.BoolValue enable_context_propagation = 9; |
There was a problem hiding this comment.
Should we change this to disable_context_propagation to align with disable_span_reporting and also aligns with existing default (which is enabled by default) so there is no special logic in code to default it to true?
cc: @zirain
There was a problem hiding this comment.
I was thinking align with enable_istio_tags, but either is fine to me.
There was a problem hiding this comment.
Ok. It seems logical to align with span reporting as they are related and easy to understand
There was a problem hiding this comment.
hmm I agree, we can rename, @ramaraochavali shall I rename this to disable_context_propagation ? It aligns with envoy no_context_propogation
There was a problem hiding this comment.
@ramaraochavali I have updated the code with the changes.
Description
This PR adds a new
disableContextPropagationfield to the Telemetry API's Tracing configuration.fixes #58871
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:
disableSpanReporting: true(which loses observability)Solution
Add
disableContextPropagation(defaults totrue) to the Tracing config. When set tofalse:X-B3-*,traceparent,tracestate, etc.) are not propagated in forwarded requestsExample Usage