This module lets you collect metrics from an Executor Service, be it a Thread Pool Executor or a Fork Join Pool. To
start tracking an Executor Service you will need to register it with the executors module by calling
ExecutorsInstrumentation.instrument(...) as shown below:
val executor = java.util.concurrent.Executors.newFixedThreadPool(10) val instrumented = ExecutorInstrumentation.instrument(executor, "sample-executor") // Form this point on, submit tasks to the "instrumented" executor.
You will get back an instrumented Executor Service that will be recording metrics until it is shut down. It is important to ensure that the instrumented executor is being used and not the original one, otherwise some metrics and Context propagation features will not work as expected.
When instrumenting an Executor Service you have the possibility to tweak two different options:
The following metrics are collected for both
Additionally, the parallelism setting is also reported for
In case you are not using the Kamon Bundle, add the dependency below to your build to instrument Akka 2.4 and Akka 2.5 applications.
libraryDependencies += "io.kamon" %% "kamon-executors" % "2.5.9"
<dependency> <groupId>io.kamon</groupId> <artifactId>kamon-executors_2.13</artifactId> <version>2.5.9</version> </dependency>
You must start your application with the instrumentation agent for this module to work properly.