solo-io / gloo

The Feature-rich, Kubernetes-native, Next-Generation API Gateway Built on Envoy
https://docs.solo.io/
Apache License 2.0
4.04k stars 431 forks source link

Set tracestate on trace initiated by gloo from an incoming/transformed header #9645

Open huzlak opened 1 month ago

huzlak commented 1 month ago

Gloo Edge Product

Enterprise

Gloo Edge Version

v1.16.7

Is your feature request related to a problem? Please describe.

I want to set tracestate header value based on value of a header created by transformation when trace is initiated by gateway-proxy. Currently envoy only sets empty tracestate when it initiates the trace.

Describe the solution you'd like

An option in tracing provider configuration that would allow that, e.g.:

    tracing:
      openTelemetryConfig:
        tracestateFromHeader: $headerName
        collectorUpstreamRef:
          namespace: "gloo-system"
          name: "opentelemetry-collector"

Describe alternatives you've considered

Using baggage to propagate the header, but it's currently not propagated by upstream services which makes it a non-viable solution. Using a transformation to set the header doesn't work as it's overridden by the tracer.

Additional Context

No such option is currently available in upstream envoy opentelemetry tracer.

soloio-bot commented 1 month ago

Zendesk ticket #3912 has been linked to this issue.

DuncanDoyle commented 1 month ago

@nfuden According to the linked Zendesk ticket, when you try to set the tracestate header in a regular stagedTransformation, it gets overridden/reset by the tracer. Before we dive into adding new options to configurations, can you check what's actually happening, and see if there is an option to do this via a transformation. Since we had that discussion about being able to define more transformations in the chain, we might actually have a use-case for it here ....