router icon indicating copy to clipboard operation
router copied to clipboard

Opentelemetry Exporter doesn't propagate Zipkin headers.

Open edude03 opened this issue 3 years ago • 0 comments
trafficstars

Describe the bug We use Ambassador in front of the Apollo Router, which uses envoy internally, and so we have it configured to propagate Zipkin B3 headers to downstream services.

In our Javascript based graphql gateway, it is able to take in Zipkin B3, but send otlp encoded spans downstream.

Looking at the code for the Apollo router, this should work here as well, but it doesn't.

To Reproduce Steps to reproduce the behavior:

Deploy apollo router v0.11-v0.15. (the versions I've tested) with the following config:

server:
  listen: 0.0.0.0:8080

telemetry:
  tracing:
    propagation:
      # https://www.w3.org/TR/baggage/
      baggage: false

      # https://www.datadoghq.com/
      datadog: false

      # https://www.jaegertracing.io/ (compliant with opentracing)
      jaeger: true

      # https://zipkin.io/ (compliant with opentracing)
      zipkin: true

      # https://www.w3.org/TR/trace-context/
      trace_context: true
    trace_config:
      service_name: "router"
    otlp:
      # Either 'default' or a URL
      endpoint: http://otel-collector.opentelemetry:4317

Make a request like

curl -X POST \
    -H "Content-Type: application/json" \
    -H "X-B3-Parentspanid: 090a4bf268332c5c" \
    -H "X-B3-Sampled: 1" \
    -H "X-B3-Spanid: e976bd86b99faf5f" \
    -H "X-B3-Traceid: 47fe2de35b93fa39090a4bf268332c5c" \
    -H "X-Envoy-Internal: true" \
    -H "X-Request-Id: de5ad424-eaaa-9e06-a1fb-bc3b431736ca" \
  http://apollo-router.gateway.svc.cluster.local/

Expected behavior

Downstream services should be propagated the X-B3-Sampled, X-B3-Traceid headers.

Output I used Wireshark, and I can see a new trace has been started inside the router, so the context is not preserved, for example, for the above request I'm seeing:

traceparent: 00-db663ff6581cb5bd9d41ac3db632d362-ecc96e2438a91dd1-01
    tracestate: 
    x-b3-traceid: db663ff6581cb5bd9d41ac3db632d362
    x-b3-spanid: ecc96e2438a91dd1
    x-b3-sampled: 1
    uber-trace-id: db663ff6581cb5bd9d41ac3db632d362:ecc96e2438a91dd1:0:1
    host: myservice-graphql.myservice.svc.cluster.local

being sent to my downstream service.

edude03 avatar Aug 09 '22 18:08 edude03