open-policy-agent / opa

Open Policy Agent (OPA) is an open source, general-purpose policy engine.
https://www.openpolicyagent.org
Apache License 2.0
9.6k stars 1.33k forks source link

OpenTelemetry tracing request specific header attribute #7077

Open rasmuscc opened 1 week ago

rasmuscc commented 1 week ago

What is the underlying problem you're trying to solve?

We are sending a REST request in OPA with a request specific header and would like to include this header in the OpenTelemetry span as an attribute. E.g. using: http.response.header.

Describe the ideal solution

I'd imagine it could be configured something like this:

distributed_tracing:
  type: "grpc"
  attributes:
    headers:
      - header1

Should produce a span like this: image

ashutosh-narkar commented 1 week ago

Hello @rasmuscc thanks for filing this request. If you could provide more context around why this is required and the benefit of this feature, that would be helpful. Thanks.

rasmuscc commented 1 week ago

It is not uncommon that calls to REST services include some sort of trace og log ID that is not an OpenTelemetry trace header. This feature request would support including such headers and any other header for that matter, as an OpenTelemetry trace attribute