Sha256: ae96d3683c1dda0b644b9e9220a1dded0ce4f189b33bdfc219a9bb3151609071
Contents?: true
Size: 1.2 KB
Versions: 10
Compression:
Stored size: 1.2 KB
Contents
module PrometheusExporter::Server class PumaCollector < TypeCollector PUMA_GAUGES = { workers_total: "Number of puma workers.", booted_workers_total: "Number of puma workers booted.", old_workers_total: "Number of old puma workers.", running_threads_total: "Number of puma threads currently running.", request_backlog_total: "Number of requests waiting to be processed by a puma thread.", thread_pool_capacity_total: "Number of puma threads available at current scale.", max_threads_total: "Number of puma threads at available at max scale.", } def initialize @puma_metrics = [] end def type "puma" end def metrics return [] if @puma_metrics.length == 0 metrics = {} @puma_metrics.map do |m| labels = {} if m["phase"] labels.merge(phase: m["phase"]) end PUMA_GAUGES.map do |k, help| k = k.to_s if v = m[k] g = metrics[k] ||= PrometheusExporter::Metric::Gauge.new("puma_#{k}", help) g.observe(v, labels) end end end metrics.values end def collect(obj) @puma_metrics << obj end end end
Version data entries
10 entries across 10 versions & 1 rubygems