akka-tracing
akka-tracing copied to clipboard
Trace Propagation in distributed enviornment
Hi, can SpanMetadata be used to propagate span information? How to do I get traceId and span Id of parent and how can they be attached to child in different process?
Having similar question. is it possible currently to let's say propagate paren trace information from upstream, let's say play framework down to remote akka system via available APIs ?
If not what are the places to look for in code in order to try to contribute such possibility ?
I got it working in following scenario. Akka actor(Producer) sends message to kafka. Another Akka actor in different process(Consumer) get the message processes it and send back acknowledgment.
Key here is to use SpanMetada correctly which is returned when request is sampled. I added this to Kafka message which when received by Consumer, uses this metadata to create parent request -
trace.importMetadata(parentReq, metadata, serviceName)
Now add downstream trace request as child of this parent -
trace.createChild(child, parent)
Here trace is instance of TracingExtensionImpl provided by the akka-tracing lib.
Hope this helps you
Thanks for sharing @sandeep-paliwal.
In my case I need to figure out how to map actor message to be tied under same trace started by Play framework when clients requests start of the operation via HTTP and stuff is delegated then to akka actor system. That means making sure that Play and Akka akka-tracing extension support play nicely together (is there any example or test spec for that @levkhomich ?).
Therefore I guess I need to somehow extract traceId
, spanId
and parentId
, send it along with the message sent to actor system and do trace.importMetadata for the message I wanna trace further in actor code.
Sorry for late response.
@sandeep-paliwal that's exactly how it's supposed to work.
@mtomas you can use trace.exportMetadata
on request: RequestHeader
because akka-tracing uses request ids generated by Play and there is an implicit conversion from RequestHeader
to BaseTracingSupport
.
@levkhomich is there a way I can check if tracing has been enabled or not? Also is it possible to programatically set sampling rate or enable/disable tracing instead of controlling it from application.conf
?
Hi! Faced the same issue? Isn't possible to store in message id of parent too?