Skip to content

Add B3 and Jaeger context propagators to the OPA distributed tracing. #4687

Open
@ievgenii-shepeliuk

Description

@ievgenii-shepeliuk

What part of OPA would you like to see improved?

Distributed tracing support.

Currently OPA distributed tracing supports only W3C context propagation header traceparent that is standard in Open Telemetry specification.,

So OPA instance creates/reports spans that use traceid and parent span values from traceparent header.
But OTEL spec and W3C standard is still not completely supported everywhere, so support of older tracing headers that existed before OpenTelemetry specification will be very useful.

For example, Traefik - a widely adopted API gateway and K8s Ingress controller doesn't support OTEL / W3C headers, but supports B3 and Jaeger ones.

Describe the ideal solution

I was thinking about introduction of fallback mechanism via what is called "composite propagator" in OTEL specification.
i.e. OPA would iterate via several supported header formats until find one that can extract parent trace info from headers

  1. try to find W3C traceparent header ( current behaviour)
  2. if not found then try to extract Jaeger's uber-trace-id
  3. if not found then try to extract B3 headers

Additional Context

  1. Existing Go libraries to use
    https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/propagators

  2. Probable place to inject propagators in OPA code
    https://github.com/open-policy-agent/opa/blob/main/internal/distributedtracing/distributedtracing.go#L122

The solution should only be injecting additional propagators together with current W3C one. There should not be a need to manually implement fallback.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions