I created a sample service in Akka for testing Kamon + DataDog monitoring.
Here are dependencies which I added:
"io.kamon" %% "kamon-core" % "1.1.0",
"io.kamon" %% "kamon-datadog" % "1.0.0",
"io.kamon" %% "kamon-akka-2.5" % "1.0.1"
Here are plugins enabled in build.sbt:
.enablePlugins(AshScriptPlugin, DockerPlugin, SbtAspectJRunner)
Then application.conf:
kamon {
datadog {
time-units = "ms"
memory-units = "b"
}
util {
filters {
"akka.tracked-actor" {
includes = [ "testSystem/user/**" ]
excludes = [ "testSystem/system/**" ]
}
"s3-worker-actors" {
includes = [ "testSystem/user/s3Router/*" ]
}
"fb-worker-actors" {
includes = [ "testSystem/user/fbRouter/*" ]
}
"akka.tracked-router" {
includes = [ "testSystem/user/s3Router", "testSystem/user/fbRouter" ]
}
"akka.tracked-dispatcher" {
includes = [ "**" ]
}
"akka.traced-actor" {
includes = [ "**" ]
}
}
}
akka.actor-groups = [ "s3-worker-actors", "fb-worker-actors" ]
}
Finally in the Main class I invoke:
Kamon.addReporter(new DatadogAgentReporter())
On EC2 I installed datadog-agent for docker.
When I run the service container on the EC2 instance and then look into the DataDog interface I don't see any related metrics to akka, just a list of standard metrics like: datadog.process.agent, docker.cpu.usage, system.io.await etc
How to enable akka related metrics in case when an akka app is packaged into docker and deployed on EC2?
It is necessary to add AspectJ weaver as Java Agent when you're starting your Akka aplication:
-javaagent:aspectjweaver.jarYou can add the following settings in your project SBT configuration:
So AspectJ weaver JAR will be copied to
./lib_managed/jars/org.aspectj/aspectjweaver/aspectjweaver-[aspectJWeaverV].jarin your project root.Then you can refer this JAR in your Dockerfile: