apollographql / router

A configurable, high-performance routing runtime for Apollo Federation 🚀
https://www.apollographql.com/docs/router/
Other
797 stars 266 forks source link

`propagation.baggage` has no effect #2473

Open lennyburdette opened 1 year ago

lennyburdette commented 1 year ago

Describe the bug I can't get any baggage headers to propagate to subgraphs using tracing.propgation.baggage.

Header propagation works great so I wonder if we should just remove this configuration option?

headers:
  all:
    request:
      - propagate:
          named: baggage

To Reproduce

  1. Client request:
    curl --request POST \
    --header 'content-type: application/json' \
    --header 'apollographql-client-name: MyClient' \
    --header 'apollographql-client-version: 1.0' \
    --header 'baggage: key1=value1' \
    --url http://localhost:4000/ \
    --data '{"query":"query Query {\n  viewer {\n    id\n    firstName\n    lastName\n    createdAt\n    profile {\n      id\n      profile1\n      paymentMethods {\n        id\n        kind\n        number\n      }\n    }\n  }\n}"}'
  2. Router config:
    telemetry:
      tracing:
        trace_config:
          service_name: router
          service_namespace: router
        propagation:
          baggage: true
        otlp:
          endpoint: otel-collector:4317
          protocol: grpc

Expected behavior The subgraph should receive headers like this:

{
  "baggage": "key1=value1",
  "content-type": "application/json",
  "accept": "application/json, application/graphql-response+json",
  "traceparent": "00-8fadbf24f4e7c108dbfb8cd5587caabe-242649777ba02ea9-01",
  "tracestate": "",
  "accept-encoding": "gzip,deflate,br",
  "host": "localhost:4002",
  "content-length": "166"
}

But I'm not seeing the baggage header unless I also set up header propagation using the workaround described above.

Desktop (please complete the following information):

Additional context I found this while creating some documentation, I don't know if anyone has encountered it in the wild.

bnjjj commented 1 year ago

Maybe unrelated but I had that kind of issue with Jaeger propagators previously and it was due to the ordering. It's explained in this comment maybe it's something somewhat related

@lennyburdette A good test to check is to try to enable only the baggage propagation and nothing else. To see if we have headers

lennyburdette commented 1 year ago

yeah i tried all permutations of the propagation settings, with and without an actual trace exporter, and i'm still not seeing anything sent to subgraphs.