opentelemetry-java-instrumentation icon indicating copy to clipboard operation
opentelemetry-java-instrumentation copied to clipboard

Support Akka Streams

Open jenoOvchi opened this issue 3 years ago • 5 comments

Hi!

Is it possible to implement Akka Streams Support for opentelemetry-javaagent?

jenoOvchi avatar May 20 '21 15:05 jenoOvchi

Hey @jenoOvchi ,

Unfortunately we won't have the capacity to implement this ourselves, but we'll gladly accept external contributions.

mateuszrzeszutek avatar May 21 '21 13:05 mateuszrzeszutek

@jenoOvchi What kind of support are you looking for? Context propagation to stream completion callback or something else?

laurit avatar Jun 10 '21 12:06 laurit

@laurit, We use alpakka-kafka to handle and then send new messages to kafka. Accordingly the reading of messages by the consumer and sending by the producer are further separated by asynchronous business logic. The processing flow looks something like this: kafka-consumer -> akka-stream -> kafka-producer. I saw that there is already support for context propagation at the vanilla kafka consumer/producer, but only for synchronous message processing. However, in akka streams messages are processed asynchronously, i.e. after that action in KafkaConsumerActor the batch read by the consumer from kafka is sent entirely to the actor after which the context is lost if it was in some message: KafkaConsumerActor.scala#L632. I also saw that there is already support for context propagation for actors.

I think it would be possible to try adding a tracing context to the existing context forwarding mechanism in akka streams SourceWithContext.scala, somewhere here(MessageBuilder.scala) along with the forwarding offset of the read message and then in the kafka producer we can pull this tracing context to propagate.

unit7-0 avatar Jun 16 '21 15:06 unit7-0

@mateuszrzeszutek @laurit has there been any progress with this ticket since last update?

suzilxptr avatar Apr 26 '24 07:04 suzilxptr

@suzilxptr no progress

laurit avatar Apr 26 '24 07:04 laurit

https://github.com/kamon-io/Kamon/tree/master/instrumentation/kamon-alpakka-kafka/src/main would be a good guideline as to what is needed here

pjfanning avatar Sep 28 '24 22:09 pjfanning