Unlimited services in the new APM plans! Monitor unlimited services with the new APM plans!

You are viewing documentation for an outdated version. Do you wish to see documentation for the latest version?

Executor Service Instrumentation #

This module lets you collect metrics from executor service: Thread Pool Executors and Fork Join Pools. To start tracking an executor service you must register it with the executors module by calling kamon.executors.Executors.register(...) as shown below:

  val threadPool = java.util.concurrent.Executors.newFixedThreadPool(10)
  val registration = Executors.register("sample-thread-pool", threadPool)


  registration.cancel() // Later on, when shutting down the executor service.

You will get back a Registration that you can cancel at any moment if you want to stop tracking the executor service. That is something you should definitely do before shutting down the executor service.

Dependency Installation #


libraryDependencies += "io.kamon" %% "kamon-executors" % "1.0.2"



    <dependency>
      <groupId>io.kamon</groupId>
      <artifactId>kamon-executors_2.13</artifactId>
      <version>1.0.2</version>
    </dependency>


implementation 'io.kamon:kamon-executors_2.13:1.0.2'

You must start your application with the instrumentation agent for this module to work properly.

Exposed Metrics #

Regardless of the type, all executor services will get the following metrics:

  • executor.threads (Histogram). Samples the number of threads in the executor service. Tags:
    • state: Active (state=active) and total (state=total).
  • executor.tasks (Counter). Tracks the number of tasks processed by the executor service. Tags:
    • state: Submitted (state=submitted) and completed (state=completed).
  • executor.queue (Histogram). Samples the queue size for the executor service.

Additionally, all executor service metrics will also have the following tags:

  • name: With the name provided during registration.
  • type: Fork Join Pool (type=fjp) or Thread Pool Executor (type=tpe).

Additional Metrics for Thread Pool Executors #

  • executor.pool (Gauge). Tracks several configuration settings for the executor service . Tags:
    • setting=min: Minimum pool size.
    • setting=max: Maximum pool size.
    • setting=corePoolSize: Core pool size.

Additional Metrics for Fork Join Pools #

  • executor.pool (Gauge). Tracks several configuration settings for the executor service . Tags:
    • setting=min: Minimum pool size.
    • setting=max: Maximum pool size.
    • setting=parallelism: Parallelism.