Documentation
Sponsored by Kamino

Message Tracing

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:

  • A akka.actor.dequeued mark when the message is taken out of the mailbox to start processing.
  • All these tags:
    • component=akka.actor: Component marker. It’s constant on all Spans.
    • akka.system: Actor system name.
    • akka.actor.path: Actor path.
    • akka.actor.class: Actor class.
    • akka.actor.message-class: Message class.

Customizing the Message Span

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.
  }