Hi everyone,
I’m currently running Kong Gateway (v3.4.x, but planning for v3.6+) and using the OpenTelemetry (OTEL) plugin to send traces to Dynatrace.
The Challenge: We need to capture a specific custom header—x-dyntrace-test (used by NeoLoad for performance testing)—and include it as an attribute within the OpenTelemetry span.
According to Kong Support, the current OTEL plugin only supports standard tracing propagation headers (W3C, B3, etc.) and cannot be configured to “pluck” a custom, non-tracing header and inject it into the span attributes. A feature request has been filed (GTWY-I-1369), but we need a solution sooner.
The Constraint: I am looking for suggestions that do not involve modifying the core OTEL plugin code or writing a heavy custom plugin if possible.
Current Setup:
JSON
{
"endpoint": "http://traceingest.dynatrace.svc.cluster.local:4318/v1/traces",
"header_type": "w3c",
"resource_attributes": {
"service.name": "kong-gateway"
}
}
Questions
-
Has anyone successfully used the Serverless Post-Function (or Pre-Function) plugin to access the current span and manually add an attribute via the Lua SDK (
kong.tracing)? -
Is there a way to leverage standard OpenTelemetry environment variables (like
OTEL_RESOURCE_ATTRIBUTES) to dynamically pick up request headers, or is that strictly limited to static process-level data? -
Are there any clever “sidecar” patterns or OpenTelemetry Collector transformations that could intercept the traffic and map a header to an attribute before it hits the backend?
I’d love to hear how others are handling custom business/test metadata in their traces.
Thanks in advance!