krakend / krakend-ce

KrakenD Community Edition: High-performance, stateless, declarative, API Gateway written in Go.
https://www.krakend.io
Apache License 2.0
1.94k stars 453 forks source link

Tracing headers not propagate to backend #884

Closed raafael closed 4 months ago

raafael commented 4 months ago

Environment info:

I'm not getting the tracing headers in my backend, in the docs https://www.krakend.io/docs/endpoints/parameter-forwarding/#default-headers-sent-from-krakend-to-backends I understand if we are using tracing in krakend the headers: X-B3-Sampled, X-B3-Spanid and X-B3-Traceid should arrive at backend.

I'm debbuging the headers in a Golang app that krakend call and there isn't any header about tracing. In my krakend configuration file for backend I configure "input_headers" with "*". And I'm using the tracing config from the docs export to jaeger.

"telemetry/opentelemetry": {
    "service_name": "krakend",
    "metric_reporting_period": 1,
    "layers": {
        "global": {
            "report_headers": true
        },
        "proxy": {
            "report_headers": true
        },
        "backend": {
            "metrics": {
                "disable_stage": true
            },
            "traces": {
                "disable_stage": false,
                "round_trip": true,
                "read_payload": true,
                "detailed_connection": true,
                "report_headers": true
            }
        }
    },
    "exporters": {
        "prometheus": [
            {
                "name": "prometheus_exporter",
                "port": 9090,
                "process_metrics": true,
                "go_metrics": true
            }
        ],
        "otlp": [
            {
                "name": "local_jaeger",
                "host": "jaeger",
                "port": 4317,
                "use_http": false,
                "disable_metrics": true
            }
        ]
    }
}

Am I missing something?

rassmate commented 4 months ago

I think the heaeders you are looking for is tracestate and traceparent https://www.w3.org/TR/trace-context/

Do you get them in your backend?

The documentation seems not really up to date

alombarte commented 4 months ago

Hello @raafael , @rassmate is right, the documentation is not up to date. This section of the documentation referred to the recently deprecated OpenCensus implementation, which used X-B3-style headers. OpenTelemetry uses W3C TraceContext. We will update this section, thanks!