odigos-io / opentelemetry-go-instrumentation

OpenTelemetry auto-instrumentation for Go applications
Apache License 2.0
292 stars 44 forks source link

Adding net/http client instrumentor #50

Open oxeye-gal opened 1 year ago

oxeye-gal commented 1 year ago

Hi,

This PR attempts to add instrumentation for net/http client.

We do it by writing a fake tophash value (as calculating the correct one will be harder to achieve) to the first headers map bucket and writing the "traceparent" header key and value into memory.

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 which in turn sends an http request to an additional instrumented Go http server.

The produced trace looks like the following:

image

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

edeNFed commented 1 year ago

So sorry for the huge delay! I promise to finish looking on this by the end of this week

vreynolds commented 1 year ago

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

oxeye-gal commented 1 year ago

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

MikeGoldsmith commented 1 year ago

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.

vreynolds commented 1 year ago

fwiw, I was able to see this work writing traceparent headers in a test app, with a small change to how link.UprobeOptions are initialized. Looks like in the OTel repo the offsets should be passed as Address option rather than Offset