Module: Wurk::Metrics::ProcessFamilies

Extended by:
Exposition
Defined in:
lib/wurk/metrics/process_families.rb

Overview

The /metrics families read from this process's memory rather than Redis: ProcessCounters, the Redis pool gauges, the per-class duration histograms, and (inside a swarm child) the parent's restart counters. Under a swarm these describe the child that owns the health port, except the restart counters, which are the parent's own.

Constant Summary collapse

HISTOGRAM_CLASSES =

Per-class duration series beyond this many classes (by volume) fold into class="other", so a scrape stays bounded however many classes run.

20
HISTOGRAM_LE =
Histogram::BUCKET_INTERVALS.map { |ms| ms >= 1e20 ? '+Inf' : (ms / 1000.0).to_s }.freeze
COUNTERS =
[
  ['wurk_fetch_errors_total', 'Fetch-loop errors in the process serving this scrape.', :fetch_errors],
  ['wurk_reaper_reclaimed_total', 'Orphaned jobs reclaimed by the process serving this scrape.',
   :reaper_reclaimed],
  ['wurk_poison_kills_total', 'Jobs sent to the dead set for being orphaned too often.', :poison_kills],
  ['wurk_leader_acquired_total', 'Times the process serving this scrape became leader.', :leader_acquired],
  ['wurk_client_buffer_dropped_total', 'Jobs dropped from the reliable_push outage buffer.', :client_buffer_drops]
].freeze
RESTART_REASONS =
%i[crash recycle liveness rolling].freeze

Class Method Summary collapse

Class Method Details

.render(out, swarm: nil) ⇒ Object

swarm is a Swarm::RestartCounters::Snapshot, nil outside a swarm child.



33
34
35
36
37
38
39
40
# File 'lib/wurk/metrics/process_families.rb', line 33

def render(out, swarm: nil)
  counters(out)
  scheduler(out)
  redis_pools(out)
  job_durations(out)
  swarm_restarts(out, swarm) if swarm
  out
end