-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OTEL plugin sends incoming W3C tracestate and Instana tracing HTTP headers out as received #12494
Comments
Okay, found a workaround for this issue. 🎉 🎉 🎉 😃 First working custom LUA code: -- Modify the root span
local root_span = kong.tracing.active_span()
-- Use NGINX request API directly
h = ngx.req.get_headers()
local span_id_in = h["x-instana-s"]
local tracestate_in = h["tracestate"]
if span_id_in then
root_span:set_attribute("headers.x-instana-s", span_id_in)
root_span:set_attribute("headers.dropping-x-instana-s", "true")
ngx.req.set_header("x-instana-s", "")
else
root_span:set_attribute("headers.no-x-instana-s", "true")
end
if tracestate_in then
root_span:set_attribute("headers.tracestate", tracestate_in)
root_span:set_attribute("headers.dropping-tracestate", "true")
ngx.req.set_header("tracestate", "")
else
root_span:set_attribute("headers.no-tracestate", "true")
end My demo uses the declarative YAML config and Kong without database. So I have to put the code into
plugins:
- name: opentelemetry
config:
endpoint: "http://instana-agent:4318/v1/traces"
resource_attributes:
service.name: "kong-otel-demo"
- name: post-function
config:
access: ["${OTEL_LUA_CODE}"] |
So the last remaining things that I'm requesting are:
Thanks in advance. |
Hi @sriemer thank you for opening this issue.
The good news is that the tracing headers propagation module has just been reworked to allow more configurability of tracing headers propagation and also to make it easier to add support for new headers. The feature has not been released yet and as of today it is only available in development branches/images. Documentation updates are still WIP but will include examples of tracing headers configurations, we will make sure to cover the points you highlighted. If you'd like to check out what's changed you can have a look in the master branch:
In order to add support for a new header type so that it can be configured to be Thank you |
This issue is marked as stale because it has been open for 14 days with no activity. |
Dear contributor, We are automatically closing this issue because it has not seen any activity for three weeks. Your contribution is greatly appreciated! Please have a look Sincerely, |
@samugi Thanks so much for that great work. 🙏 That will help us a lot. I'll discuss this with our product management and check when we can do the Instana support for this. |
Is there an existing issue for this?
Kong version (
$ kong version
)Kong 3.5.0
Current Behavior
Receiving Instana + W3C tracing headers like
Sending out tracing headers like
Next Instana tracer in the chain picks up span ID from
X-INSTANA-S
, fallback:tracestate
in
member, only thentraceparent
. So on the Instana UI it appears as if spans are directly sent from client app to server app without Kong.Expected Behavior
Would be nice to be able to add support for Instana headers or at least filtering out Instana headers and the
tracestate
header.Is that possible with custom LUA code?
Does "customize OTel spans as a developer" (https://docs.konghq.com/hub/kong-inc/opentelemetry/#customize-opentelemetry-spans-as-a-developer) work for this?
So expecting to see just header
traceparent
here with the new span ID:Steps To Reproduce
kong-tracing
-> it is private for now.env
docker-compose build && docker-compose up
ip -s a | grep $(docker inspect $(docker ps | grep kong-tracing_kong | cut -d' ' -f1) | grep "Gateway.*[0-9\.]\+" | grep -o "[0-9\.]\+")
tcpdump
viatcpdump -s 0 -i $BRIDGE_INTERFACE -w kong-tracing-demo.pcap
wireshark
OTel plugin config:
Anything else?
OS: Linux x86_64
The text was updated successfully, but these errors were encountered: