Need guidance with production monitoring?
Book FREE office hours and we'll help you out
Not sure how to approach production monitoring? Book FREE office hours and we'll help you out

You are viewing documentation for an outdated version. Do you wish to see documentation for the latest version?

Instrumentation/Available Instrumentation

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 below:

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 below adds a custom tag to the Span:

  def receive = {
    case anything =>
      Kamon.currentSpan().tag("my-tag", "awesome-value")

      // do your processing here.
  }
On this article
Kamon APM Logo
Monitor and fix issues in production without being an expert
Learn about APM
Try Kamon APM I know how Kamon APM can help with monitoring. Don't show this again.