opentelemetry-erlang-contrib icon indicating copy to clipboard operation
opentelemetry-erlang-contrib copied to clipboard

Add Broadway instrumentation library

Open andrewhr opened this issue 3 years ago • 8 comments

Library to instrument Broadway topologies, including trace linking.

Broadway is a tricky one to describe in OpenTelemetry. It feels like a good one to follow Messaging semantics (like Oban), though they're doesn't plainly map to it.

The approach taken here are usage of custom attributes to have a good start, while waiting for those Messaging semantics to stabilize - looks like they will change a lot anyway in some near future.

One alternative is to model each GenStage as it's own destination, sort-of.

Another experiment done in this patch is adding some means to propagate traces as links. Broadway doesn't give great means to do without some friction. The approach here is to add a wrapper for Broadway.start_link/2 to inject extra configuration that will take care of this context extraction and propagation.

It relies on Producer transformers and peek on some implementation details of official Producers (all them have some behaviour-based clients we can wrap, but not exactly public API). The good thing is this is all optional - just required if span linking is desired.

andrewhr avatar Jun 09 '22 14:06 andrewhr

For the record: while a lot of this is experimental in the sense attributes, methods of propagation etc are WIP, a similar impl is in prod.

andrewhr avatar Jun 09 '22 14:06 andrewhr

Any movement on this? Is this blocked by anything? Would love to get open telemetry tracing with broadway

tielur avatar Aug 09 '23 21:08 tielur

@andrewhr any update?

tsloughter avatar Aug 09 '23 23:08 tsloughter

@tsloughter @tielur sorry for the slow answer. I plan to revisit this implementation this week, as I do need in my current job - mostly keep up to date and give a quick test on a real app.

The caveat @tsloughter is the name has been captured in the meantime. @tomtaylor has been active here, so maybe he can transfer and we could overwrite with a new implementation? I would say what we have in this PR is more complete and deals with span link / propagation so it's worth :)

andrewhr avatar Aug 16 '23 13:08 andrewhr

Great.

And that'd be great if @tomtaylor agrees?

tsloughter avatar Aug 16 '23 15:08 tsloughter

Hi folks - very happy to give this library name over if there's a more complete implementation. I've not properly looked at what @andrewhr has implemented, but on the surface it looks more complete, so let's do it. What's the best way to do that?

tomtaylor avatar Aug 17 '23 12:08 tomtaylor

Looks like we had some good movement on this about 2 weeks ago, I'd love to see this make it to the finish line. Does anyone have steps to take to get this working.

Do we need this PR merge prior to the library name transfer?

tielur avatar Sep 14 '23 04:09 tielur

@tielur name transfer can wait until after merge.

Just waiting on @andrewhr to pull in updates from main and mark this as ready instead of draft.

tsloughter avatar Sep 15 '23 22:09 tsloughter