Additionally to all metrics and context propagation that you can get with Kamon, you can also use the instrumentation to generate Spans for actor messages using Kamon’s tracing API, effectively giving you distributed tracing for your Akka applications, wohoo!
Tracing must be enabled on a per-actor basis using the akka.traced-actor
filter as shown bellow:
kamon.util.filters {
"akka.traced-actor" {
includes = [ "my-app/user/job-manager", "my-app/user/worker-*" ]
excludes = [ "my-app/system/**", "my-app/user/worker-helper" ]
}
}
All Spans generated for actor messages will start when a message is sent to an actor and finish when the message processing has finished. Additionally, these Spans will get:
In case you would like to modify the Span automatically created by instrumentation, you can access it using the Kamon.currentSpan()
shortcut and do anything you want with it! This example bellow adds a custom tag to the Span:
def receive = {
case anything =>
Kamon.currentSpan().tag("my-tag", "awesome-value")
// do your processing here.
}