Available Metrics
The metrics are organized into several categories based on platform support and metric type.CPU Starvation
Platforms: JVM, Scala.js, Scala Native. These metrics could help identify performance bottlenecks caused by an overloaded compute pool, excessive task scheduling, or lack of CPU resources.| Name | Description | Unit |
|---|---|---|
| cats_effect.runtime.cpu_starvation.count | CPU starvation count | |
| cats_effect.runtime.cpu_starvation.clock_drift.current | CPU starvation current clock drift | ms |
| cats_effect.runtime.cpu_starvation.clock_drift.max | CPU starvation max clock drift | ms |
Work-Stealing Thread Pool - Compute
Platforms: JVM. Built-in attributes:pool.id- the id of the work-stealing thread pool
| Name | Description | Unit |
|---|---|---|
| cats_effect.runtime.wstp.compute.fiber.enqueued_count.total | Compute pool total enqueued fiber count | |
| cats_effect.runtime.wstp.compute.fiber.active_count.current | Compute pool current active fiber count | |
| cats_effect.runtime.wstp.compute.fiber.suspended_count.current | Compute pool current suspended fiber count | |
| cats_effect.runtime.wstp.compute.thread.worker_count.current | Compute pool current worker thread count | |
| cats_effect.runtime.wstp.compute.thread.searcher_count.current | Compute pool current searcher thread count | |
| cats_effect.runtime.wstp.compute.thread.blocked_count.current | Compute pool current blocked worker thread count |
Work-Stealing Thread Pool - Thread
Platforms: JVM. Built-in attributes:pool.id- the id of the work-stealing thread pool the worker is used byworker.index- the index of the worker threadthread.event- the thread event:parked- a thread is parkedpolled- a thread is polled for I/O eventsblocked- a thread is switched to a blocking thread and been replacedrespawn- a thread is replaced by a newly spawned thread
| Name | Description | Unit |
|---|---|---|
| cats_effect.runtime.wstp.thread.event.count | Worker thread event count |
Work-Stealing Thread Pool - Local Queue
Platforms: JVM. Built-in attributes:pool.id- the id of the work-stealing thread pool the queue is used byworker.index- the index of the worker thread the queue is used by
| Name | Description | Unit |
|---|---|---|
| cats_effect.runtime.wstp.local_queue.fiber.total_count | Local queue total fiber count | |
| cats_effect.runtime.wstp.local_queue.fiber.total_spill_count | Local queue total fiber spill count | |
| cats_effect.runtime.wstp.local_queue.fiber.total_spill_count.successful | Local queue total successful fiber spill count | |
| cats_effect.runtime.wstp.local_queue.fiber.total_steal_attempt_count | Local queue total fiber steal attempt count | |
| cats_effect.runtime.wstp.local_queue.fiber.total_steal_attempt_count.successful | Local queue total successful fiber steal attempt count | |
| cats_effect.runtime.wstp.local_queue.fiber.current_count | Local queue current fiber count | |
| cats_effect.runtime.wstp.local_queue.fiber.current_count.real | Local queue current real fiber count |
Work-Stealing Thread Pool - Timer Heap
Platforms: JVM. Built-in attributes:pool.id- the id of the work-stealing thread pool the timer heap is used byworker.index- the index of the worker thread the timer heap is used bytimer.state- the state of the timer:executed- the successfully executed timerscheduled- the scheduled timercanceled- the canceled timer
| Name | Description | Unit |
|---|---|---|
| cats_effect.runtime.wstp.timer_heap.timer.count | Timer heap timer count |
Work-Stealing Thread Pool - Poller
Platforms: JVM. Built-in attributes:pool.id- the id of the work-stealing thread pool the poller is used byworker.index- the index of the worker thread the poller is used bypoller.operation- the operation performed by the poller:acceptconnectreadwrite
poller.operation.status- the status of the operation:submitted- the operation has been submittedsucceeded- the operation has succeedederrored- the operation has erroredcanceled- the operation has been canceled
| Name | Description | Unit |
|---|---|---|
| cats_effect.runtime.wstp.poller.operation.count | Poller operation count |
Getting Started
Add the following configuration to your build tool:- sbt
- Scala CLI
Add settings to the
build.sbt:Registering Metrics Collectors
IORuntimeMetrics.register takes care of the metrics lifecycle management.
Grafana Dashboard
You can use a Grafana dashboard to visualize collected metrics.Customization
The behavior of theIORuntimeMetrics.register can be customized via IORuntimeMetrics.Config.
CPU Starvation
To disable CPU starvation metrics:Work-Stealing Thread Pool - Compute
To disable compute metrics:Additional Configuration Options
You can also configure:- Thread metrics - Enable/disable or add attributes to worker thread event tracking
- Local queue metrics - Control fiber queue monitoring
- Timer heap metrics - Manage timer scheduling insights
- Poller metrics - Configure I/O operation tracking
For complete configuration examples for all metric types, refer to the source documentation or the API reference.
Best Practices
Start with default configuration
Use
IORuntimeMetrics.Config.default initially and only customize when you have specific needs.Monitor in production
These metrics are designed to be low-overhead and safe to enable in production environments.
Use with Grafana
Set up the official Grafana dashboard for visual monitoring of your runtime metrics.
Correlate with traces
Combine runtime metrics with distributed tracing to get a complete picture of your application’s performance.