Skip to content
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

Adding context propagation to net/http server instrumentation #49

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

oxeye-gal
Copy link
Contributor

Hi,

This PR attempts to add context propagation to the net/http server instrumentation.

We do it by iterating over the first bucket of the incoming request header map and trying to find the "traceparent" header.

This was tested with Go versions 1.12-1.19.

Our test environment consisted of instrumented Python application that sends a request to instrumented Go http server.

The produced trace looks like the following:

image

We would love to get your feedback on this.
Thanks!

@hnhbwlp
Copy link

hnhbwlp commented Feb 22, 2023

I think it is necessary to check whether the traceparent exists before inserting elements into the map, because if the same key exists, there may be logic errors when writing the http header.

@vreynolds
Copy link

@oxeye-gal any interest in re-opening this in https://github.com/open-telemetry/opentelemetry-go-instrumentation ?

@oxeye-gal
Copy link
Contributor Author

Hi @vreynolds, sure thing i'll do it later this week.

@MikeGoldsmith
Copy link

Hey @oxeye-gal - If you would like help porting this to the OTel repo, let me know -- I'm happy to help however I can.

JamieDanielson added a commit to honeycombio/opentelemetry-go-instrumentation that referenced this pull request Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants