Module: Phronomy::Metrics

Defined in:
lib/phronomy/metrics.rb

Overview

Runtime observability snapshot for the two concurrency boundaries: EventLoop and OffloadPool.

Class Method Summary collapse

Class Method Details

.snapshotObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/phronomy/metrics.rb', line 7

def self.snapshot
  runtime = Runtime.instance
  pool = runtime.offload
  event_loop = runtime.event_loop

  {
    offload_pool_active: pool.active_count,
    offload_pool_queue_length: pool.queue_depth,
    offload_pool_abandoned_active: pool.abandoned_active_count,
    offload_pool_abandoned_total: pool.abandoned_count,
    offload_pool_size: pool.pool_size,
    event_loop_queue_depth: event_loop.queue_depth,
    event_loop_queue_max_depth: event_loop.max_queue_depth,
    event_loop_lag_last_ms: (event_loop.last_lag_seconds * 1000).round(3),
    event_loop_lag_max_ms: (event_loop.max_lag_seconds * 1000).round(3),
    event_loop_lag_average_ms: (event_loop.average_lag_seconds * 1000).round(3)
  }
end