Monitoring Akka.NET Systems with Datadog

If you know me you know that if I can't monitor something in Datadog it may as well not exist, so as I'm starting to roll out some Akka.NET systems naturally I needed to get some observability in there.

There is already some basic StatsD support that ships in the core Akka.Monitoring packages, but that fell a little short of what I wanted. Namely, if your actor system is named mysystem and your actor is named myactor, Akka.Monitoring will report a restart metric for it as mysystem.myactor.akka.actor.restarts. That works, but it would be great to translate the system and actor information into tags to allow for more interesting grouping and aggregation.

To that end, my Akka.Monitoring.Datadog spike was born. This is pretty minimal at the moment, as all it's doing is some basic parsing around those metric names and translating those into new metric names and tags, but it does seem to do the trick at least. It's very much a quick first draft and not well tested yet, but I wanted to throw it out there to see if anyone else would find it useful, and also hear what others are doing around monitoring their Akka.NET systems.

To use it, you set it up much like any other Akka.Monitoring monitor, supplying it with a StatsdConfig object as required by the underlying Datadog library:

var statsdConfig = new StatsdConfig
{
    StatsdServerName = "127.0.0.1"
};
var registeredMonitor = ActorMonitoringExtension.RegisterMonitor(system, new ActorDatadogMonitor(statsdConfig));

After that you can use the standard Akka.Monitoring calls like Context.IncrementActorCreated(), Context.IncrementMessagesReceived(), etc, and they will get reported to Datadog:

Akka.NET metrics in Datadog

There is also a small sample project in the repository, based on the one found in the standard Akka.Monitoring repository.

There are undoubtedly still some kinks to work out and some more work to do, but if you're interested feel free to pull it down from NuGet and let me know how it goes!

comments powered by Disqus
Navigation