connect-go icon indicating copy to clipboard operation
connect-go copied to clipboard

Support for OpenTelemetry interceptors

Open alehechka opened this issue 2 years ago • 2 comments

Describe the solution you'd like To support capturing tracing data, it would be amazing to add out-of-the-box support for the OpenTelemetry standard into the connect-go client/server. This would likely be in the form of an interceptor function that can be optionally added to a server or client instance, similar to what is made available in opentelemetry-go-contrib. That library does provide instrumentation for other well-known packages, so it could be possible to instead add a new instrumentation for connect-go inside their library.

Describe alternatives you've considered Within my own playground for connect-go and connect-web I have been able to create a custom solution that uses the net/http instrumentation on the server-side, and a custom client-side interceptor to attach some relevant tracing data and the parent traceID to context.

My custom solution does work when using both the grpc-client and connect-go client to make requests, the resulting traces show the parent from the client and the child spans within the server.

With a better defined standard offered either in this library or as an instrumentation in opentelemetry-go-contrib would allow other developers to easily add support for OpenTelemetry with out-of-the-box tracing attributes with their connect-go server/client instances.

alehechka avatar Aug 12 '22 16:08 alehechka

Hey @alehechka - good news! Internally, we're planning to migrate from OpenCensus to OpenTelemetry. We need standardized OTel interceptors for Connect anyways, so we're going to open-source them as a separate module. We're planning to ship these interceptors as part of #343, which we hope to wrap up by early October at the latest.

akshayjshah avatar Aug 17 '22 04:08 akshayjshah

I'm now actively working on this.

akshayjshah avatar Aug 29 '22 16:08 akshayjshah

@akshayjshah Hi, are there any more updates for this yet? Thanks.

nomad-software avatar Oct 20 '22 13:10 nomad-software

I'm perpetually pulled into other work 😢 This issue is clearly important, though, so I'm handing it off to @joshcarp to make more rapid progress.

akshayjshah avatar Oct 22 '22 06:10 akshayjshah

@akshayjshah @joshcarp Hi, are there any more updates for this yet? Thanks.

nomad-software avatar Nov 30 '22 10:11 nomad-software

@nomad-software I previously implemented my own connect interceptor for otel (Unary only, for job, not open source), and have started to work on redoing that and open sourcing it in https://github.com/open-telemetry/opentelemetry-go-contrib.

If @joshcarp is still working on this, he'll probably beat me to the punch as I'm doing it in my own time, but I'll note back here if/when it's released there.

pgmitche avatar Nov 30 '22 11:11 pgmitche

Hey @nomad-software Still WIP and hasn't been abandoned

joshcarp avatar Nov 30 '22 14:11 joshcarp

Thanks @joshcarp for the update. Do you have an ETA for this please? (I'm trying to plan work around it) I think it was pencilled in for the connect v1 release but has slipped since.

nomad-software avatar Nov 30 '22 14:11 nomad-software

hey @nomad-software The bufbuild/connect-opentelemetry-go has been made public although it is unstable (so is opentelemetry I guess). There's still active development on it as it doesn't support streaming handlers/clients for tracing.

joshcarp avatar Dec 12 '22 15:12 joshcarp

@joshcarp That's awesome, thanks a lot! :+1:

nomad-software avatar Dec 12 '22 18:12 nomad-software

We'll be tagging a release of https://github.com/bufbuild/connect-opentelemetry-go in a few days, so I'm going to close this issue. Sorry for the many, many delays everyone!

akshayjshah avatar Feb 16 '23 00:02 akshayjshah

And, as a final update: https://buf.build/blog/connect-opentelemetry-go/

akshayjshah avatar Mar 06 '23 18:03 akshayjshah