Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions api/v1alpha1/envoyproxy_tracing_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,26 @@ type ZipkinTracingProvider struct {
// client and server spans sharing the same span context should be disabled.
// +optional
DisableSharedSpanContext *bool `json:"disableSharedSpanContext,omitempty"`
// TraceContextOption determines which trace context headers are used to extract
// the trace context from downstream requests and to inject it into upstream requests.
// Defaults to UseB3.
// +optional
TraceContextOption *ZipkinTraceContextOption `json:"traceContextOption,omitempty"`
}

// ZipkinTraceContextOption defines the trace context headers used by the Zipkin tracer.
// +kubebuilder:validation:Enum=UseB3;UseB3WithW3CPropagation
type ZipkinTraceContextOption string

const (
// ZipkinTraceContextOptionUseB3 uses B3 headers only, for both extraction and injection.
ZipkinTraceContextOptionUseB3 ZipkinTraceContextOption = "UseB3"
// ZipkinTraceContextOptionUseB3WithW3CPropagation extracts the trace context from B3 headers,
// falling back to the W3C traceparent header if B3 headers are absent, and injects both
// B3 and W3C traceparent headers.
ZipkinTraceContextOptionUseB3WithW3CPropagation ZipkinTraceContextOption = "UseB3WithW3CPropagation"
)

// OpenTelemetryTracingProvider defines the OpenTelemetry tracing provider configuration.
type OpenTelemetryTracingProvider struct {
// Headers is a list of additional headers to send with OTLP export requests.
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18975,6 +18975,15 @@ spec:
when creating a new trace instance. If set to false, a 64bit trace
id will be used.
type: boolean
traceContextOption:
description: |-
TraceContextOption determines which trace context headers are used to extract
the trace context from downstream requests and to inject it into upstream requests.
Defaults to UseB3.
enum:
- UseB3
- UseB3WithW3CPropagation
type: string
type: object
required:
- type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18974,6 +18974,15 @@ spec:
when creating a new trace instance. If set to false, a 64bit trace
id will be used.
type: boolean
traceContextOption:
description: |-
TraceContextOption determines which trace context headers are used to extract
the trace context from downstream requests and to inject it into upstream requests.
Defaults to UseB3.
enum:
- UseB3
- UseB3WithW3CPropagation
type: string
type: object
required:
- type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tracing:
zipkin:
enable128BitTraceId: true
disableSharedSpanContext: true
traceContextOption: UseB3WithW3CPropagation
http:
- name: "first-listener"
address: "::"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
collectorEndpoint: /api/v2/spans
collectorEndpointVersion: HTTP_JSON
sharedSpanContext: false
traceContextOption: USE_B3_WITH_W3C_PROPAGATION
traceId128bit: true
randomSampling:
value: 90
Expand Down
5 changes: 5 additions & 0 deletions internal/xds/translator/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,17 @@ func buildHCMTracing(tracing *ir.Tracing) (*hcm.HttpConnectionManager_Tracing, e
providerName = envoyZipkin

providerConfig = func() (*anypb.Any, error) {
traceContextOption := tracecfg.ZipkinConfig_USE_B3
if ptr.Deref(tracing.Provider.Zipkin.TraceContextOption, "") == egv1a1.ZipkinTraceContextOptionUseB3WithW3CPropagation {
traceContextOption = tracecfg.ZipkinConfig_USE_B3_WITH_W3C_PROPAGATION
}
config := &tracecfg.ZipkinConfig{
CollectorCluster: tracing.Destination.Name,
CollectorEndpoint: "/api/v2/spans",
TraceId_128Bit: ptr.Deref(tracing.Provider.Zipkin.Enable128BitTraceID, false),
SharedSpanContext: wrapperspb.Bool(!ptr.Deref(tracing.Provider.Zipkin.DisableSharedSpanContext, false)),
CollectorEndpointVersion: tracecfg.ZipkinConfig_HTTP_JSON,
TraceContextOption: traceContextOption,
}

return proto.ToAnyWithValidation(config)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added an optional `traceContextOption` field to the Zipkin tracing provider (`EnvoyProxy.spec.telemetry.tracing.provider.zipkin.traceContextOption`) that exposes Envoy's Zipkin `trace_context_option`; setting it to `UseB3WithW3CPropagation` extracts the trace context from B3 headers with a fallback to the W3C `traceparent` header, and injects both B3 and `traceparent` headers into upstream requests.
16 changes: 16 additions & 0 deletions site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -7209,6 +7209,21 @@ _Appears in:_
| `DraftVersion03` | XRateLimitHeadersOptionDraftVersion03 enables X-RateLimit headers using RFC draft version 03<br />for this rate limit rule, regardless of the global ClientTrafficPolicy setting.<br /> |


#### ZipkinTraceContextOption

_Underlying type:_ _string_

ZipkinTraceContextOption defines the trace context headers used by the Zipkin tracer.

_Appears in:_
- [ZipkinTracingProvider](#zipkintracingprovider)

| Value | Description |
| ----- | ----------- |
| `UseB3` | ZipkinTraceContextOptionUseB3 uses B3 headers only, for both extraction and injection.<br /> |
| `UseB3WithW3CPropagation` | ZipkinTraceContextOptionUseB3WithW3CPropagation extracts the trace context from B3 headers,<br />falling back to the W3C traceparent header if B3 headers are absent, and injects both<br />B3 and W3C traceparent headers.<br /> |


#### ZipkinTracingProvider


Expand All @@ -7222,6 +7237,7 @@ _Appears in:_
| --- | --- | --- | --- | --- |
| `enable128BitTraceId` | _boolean_ | false | | Enable128BitTraceID determines whether a 128bit trace id will be used<br />when creating a new trace instance. If set to false, a 64bit trace<br />id will be used. |
| `disableSharedSpanContext` | _boolean_ | false | | DisableSharedSpanContext determines whether the default Envoy behaviour of<br />client and server spans sharing the same span context should be disabled. |
| `traceContextOption` | _[ZipkinTraceContextOption](#zipkintracecontextoption)_ | false | | TraceContextOption determines which trace context headers are used to extract<br />the trace context from downstream requests and to inject it into upstream requests.<br />Defaults to UseB3. |


#### ZoneAware
Expand Down
9 changes: 9 additions & 0 deletions test/helm/gateway-crds-helm/all.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53352,6 +53352,15 @@ spec:
when creating a new trace instance. If set to false, a 64bit trace
id will be used.
type: boolean
traceContextOption:
description: |-
TraceContextOption determines which trace context headers are used to extract
the trace context from downstream requests and to inject it into upstream requests.
Defaults to UseB3.
enum:
- UseB3
- UseB3WithW3CPropagation
type: string
type: object
required:
- type
Expand Down
9 changes: 9 additions & 0 deletions test/helm/gateway-crds-helm/e2e.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29290,6 +29290,15 @@ spec:
when creating a new trace instance. If set to false, a 64bit trace
id will be used.
type: boolean
traceContextOption:
description: |-
TraceContextOption determines which trace context headers are used to extract
the trace context from downstream requests and to inject it into upstream requests.
Defaults to UseB3.
enum:
- UseB3
- UseB3WithW3CPropagation
type: string
type: object
required:
- type
Expand Down
9 changes: 9 additions & 0 deletions test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29290,6 +29290,15 @@ spec:
when creating a new trace instance. If set to false, a 64bit trace
id will be used.
type: boolean
traceContextOption:
description: |-
TraceContextOption determines which trace context headers are used to extract
the trace context from downstream requests and to inject it into upstream requests.
Defaults to UseB3.
enum:
- UseB3
- UseB3WithW3CPropagation
type: string
type: object
required:
- type
Expand Down
Loading