Open guolifu opened 7 months ago
Hey, I think that passing the context object from the incoming request to the outgoing one will resolve this.
(i.e Using NewRequestWithContext
to perform the get request)
Hey, I think that passing the context object from the incoming request to the outgoing one will resolve this. (i.e Using
NewRequestWithContext
to perform the get request)
Thank you very much for your assistance. 👍🏻 Following your advice, it did indeed run successfully as expected. However, for some of the code already written and deployed, we have extensively utilized the http.Get(Post) method. Are there any effective adaptation methods available to us?
Describe the bug
I have created a service using an HTTP server, and in the GET method, I called another API. I added a header, Traceparent, at the entry point of the request. However, strangely, the traceID did not propagate smoothly, but instead, a new traceID was generated. Through debugging, I found an exception message:
bpf_trace_printk: context c0000a6010 not found in context map.
In theuprobe_Transport_roundTrip
method,struct span_context *parent_span_ctx = get_parent_span_context(context_ptr_val);
returns NULL. I don't know where the problem lies. It seems that the probe startup is working fine.Environment
To Reproduce
Steps to reproduce the behavior:
build it
OTEL_GO_AUTO_TARGET_EXE=/opt/github/opentelemetry-go-instrumentation/demo/ebpf/ebpfdemo OTEL_SERVICE_NAME=my_service OTEL_EXPORTER_OTLP_ENDPOINT=http://0.0.0.0:4317 ./otel-go-instrumentation
curl -H "Traceparent: 00-95b5ec2b81e2374a4a27ce36ab71d349-18f65a5a3ab22213-01" http://10.211.55.27:81/get2
Expected behavior
TraceId should remain consistent.
Additional context
Add any other context about the problem here.