Provide actor-group metrics
Currently we have RouterMetrics which consolidate processing-time and time-in-mailbox metrics for all the routees of a given routers and it seems like a good idea to provide something similar for use with the work-queue/workers solution in which there is a number of workers that typically only process one message and then ask for the next piece of work and having a unified view of all actors is better than having individual metrics. There is a short conversation in the mailing list that started this idea: https://groups.google.com/forum/#!topic/kamon-user/7woEIS0j_KQ
The problem with actor name patterns (as currently implemented) is that they will not catch any new per-request actors that may be added to the system under different paths. This is a major concern for us as I don't expect every developer who adds an actor to the system to understand the details of what might break new relic! I would also like our Kamon config to be fairly static, and not have to keep changing as new actors are defined.
What I feel we need is a way to configure a regex, or multiple, which when matched against an actor name tells us that the actor is a per-request actor. For example, if you use akka's default naming for your actors, it will contain at least one $ in its name, so that could be the default config. In my project we don't use that naming scheme, so would need to override this default.
Also, once we have detected the per-request actor we will need to do extra normalisation of its name to get something that we can report on. That again will depend on the naming scheme implemented.
@dpsoft @ivantopo Could you provide key files where the logic reside to help with a PR in my free time?
hey @frossi85 you need dig in the Instrumentation and ActorInstrumentation as starting point!! @ivantopo WDYT?
I think there is a question to make before going to details: should we allow actors to be tracked as both regular actor/router AND in actor groups? the current instrumentation ensures that any actor is only tracked as one thing: either actor or router.. what happens if we put actor groups, should it then be one of the three options or do we make groups an independent concept?
@ivantopo i think one of the three options should be one of the two options, right?
My specific use case for groups is when i have too many actor to track independently (1 persistable actor per user in a shopping cart). I would like to aggregate the data around groups of actors (shards in my cluster). So in this scenario i would not want to track the same actor both in a group and independently.
By "one of the three" I meant that each actor is tracked as either actor, routee or group member. I'm still torn thinking on whether it makes sense for an actor to belong to more than one group.
at the moment, it seems like actor groups should be treated as a separate thing from actors/routees, meaning that besides from being an actor/routee, any could could be tracked in zero or more actor groups. I'll proceed under that idea and see how it goes.
I have an implementation of actor groups metrics in a private fork. I can try to produce a Pull Request for kamon-akka if this was thought to be useful. In my fork, I use a similar config to akka-actor but allow multiple groups to be defined with their own includes/excludes. The metrics for all actors that are included in a group are summed up for the group.
metric.filters {
akka-actor {
includes = ["**"]
excludes = [ "*/system/**", "*/user/IO-**" ]
}
akka-router {
includes = ["**"]
excludes = []
}
akka-dispatcher {
includes = ["**"]
excludes = []
}
akka-actor-groups {
all {
includes = ["**"]
excludes = [ "*/system/**", "*/user/IO-**" ]
}
}
}
@pjfanning please, go ahead and submit the PR :), that would be a nice to have feature!
Looks like pjfanning's PR #8 only implemented actor group for akka 2.3.x.
Is there plan to add it to 2.4.x and 2.5.x?
hey @ryan-ju, the PR had support for both Akka 2.3 and Akka 2.4 and we already implemented this feature for Akka 2.5 as well, but on a separate branch where we have are preparing for Kamon's 1.0 release.. if you want to try it out please let us know and we'll make sure all the dependencies you need are available for Kamon 1.0, thanks!
https://github.com/kamon-io/kamon-akka/tree/kamon-1.0
Many thanks @ivantopo, it's good to hear that this feature will be in 1.0, so my datadog will not explode with gazillion of actor tags.
Would the 1.0 alpha/release-candidate be published to bintray soon?
We already have a bunch of snapshots on our snapshots repo [1] but no datadog module yet, that one should come in a few days. Currently these modules are up:
kamon-core: 1.0.0-RC1-1d98b9e8a397acf8b6f6f55a3fd5189eb72740ba kamon-scala: 1.0.0-RC1-e51d6fe9271dc815a83463a869508528e0b61a6a kamon-executors: 1.0.0-RC1-89624cd7d9ca762332019eda57748f2f6a371fd5 kamon-akka: 1.0.0-RC1-513e168ea538f94f5de22b191580ca4faaaa52e6 (For Akka 2.3, 2.4 and 2.5) kamon-prometheus: 1.0.0-RC1-791456d06d0f7b39fb2c37187bbef3e9451515a3 (this is a brand new reporter)
I'm currently working on kamon-play.. then a few more modules (jaeger, system metrics, statsd) and then the datadog one.. there is sooo much work but we are quite happy about how our next iteration looks like.. stay tuned, things are moving fast these days and please, let us know if you decided to try this, regards!
[1] https://bintray.com/kamon-io/snapshots
@ivantopo thanks for the info, I've found the snapshot versions, and will be playing with them.
Out of curiosity, is kamon-datadog:0.6.8 going to work with the kamon-akka:1.0.0? Not sure if there are breaking changes.
nope, the 1.0.0 release is a breaking one, the APIs for collecting metrics are different and the APIs for reporters are different as well.. You will need to wait until we release a new version of kamon-datadog that is compatible with kamon-1.0.. depending on how much of Kamon you are using the changes required to upgrade will vary, but if you are using kamon-akka and reporting to datadog without much usage of Kamon APIs then that will be a easy upgrade.
@ivantopo does this mean breaking changes for all Kamon backends, including kamon-spm?
@otisg yes for all, at this moment we changed:
also we introduce some new modules:
cheers.
Thanks @dpsoft! Will you be changing other backends then, too?
@otisg Eventually all backends will be migrated ;)
Thanks @dpsoft . That "eventually" means "before Kamon 1.0" or "whenever we get to it"?