Documentation
Sponsored by Kamino

Executor Service Instrumentation

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

  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.

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.