Module: Lepus::Prometheus::Instrumentation::WorkerExtensions

Defined in:
lib/lepus/prometheus/instrumentation.rb

Overview

Emits process-level gauges on each heartbeat tick. rss_memory is keyed on (kind, name) only to avoid leaking a new series per pid; pid and hostname stay available on the ‘lepus_process_info` info gauge.

Instance Method Summary collapse

Instance Method Details

#heartbeatObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/lepus/prometheus/instrumentation.rb', line 49

def heartbeat
  super
ensure
  Lepus::Prometheus.emit(
    :process,
    kind: kind.to_s,
    name: name,
    rss_memory: safe_rss_memory_bytes
  )
  Lepus::Prometheus.emit(
    :process_info,
    kind: kind.to_s,
    name: name,
    pid: pid.to_s,
    hostname: safe_hostname
  )
end