kamon-io / kamon-akka

Kamon Instrumentation for Akka
https://kamon.io/docs/latest/instrumentation/akka/
Other
44 stars 20 forks source link

pick the right dispatcher name when deployment configuration overrides routees dispatchers #41

Closed ivantopo closed 6 years ago

ivantopo commented 6 years ago

There was a small bug in the selection of the dispatcher name when tracking routers/routees: if there was a deployment configuration (under akka.actor.deployment for the routees as this one here:

akka {
  actor {
    deployment {
      /picking-the-right-dispatcher-in-pool-router {
        router = round-robin-pool
        resizer = {
          lower-bound = 5
          upper-bound = 64
          messages-per-resize = 20
        }
      }

      "/picking-the-right-dispatcher-in-pool-router/*" {
        dispatcher = custom-dispatcher
      }
    }
  }
}

custom-dispatcher {
  executor = "thread-pool-executor"
  type = PinnedDispatcher
}

Then at the time the router is created the dispatcher name would be the akka.actor.default-dispatcher but when the routees were created the dispatcher would be properly set to custom-dispatcher. This was causing two different sets of metrics being created for each router. With these changes the instrumentation will try to resolve any deployment configuration for the routees when instrumenting the router and use that dispatcher instead of the default one.

Known limitations:

If someone gets fancy about separating the routees' dispatchers with mode complicated deployment configurations (e.g. having one dispatcher for router/$a and another for router/$b) the bug might kick again, although that seems like a rather uncommon situation.