Sha256: 3953e15eaab3867d9241ead2e953b1eec4d96a3189c2d2fa8fb0ec511854432e
Contents?: true
Size: 1.16 KB
Versions: 7
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true module PrometheusExporter::Server class SidekiqStatsCollector < TypeCollector MAX_SIDEKIQ_METRIC_AGE = 60 SIDEKIQ_STATS_GAUGES = { 'dead_size' => 'Size of dead the queue', 'enqueued' => 'Number of enqueued jobs', 'failed' => 'Number of failed jobs', 'processed' => 'Total number of processed jobs', 'processes_size' => 'Number of processes', 'retry_size' => 'Size of the retries queue', 'scheduled_size' => 'Size of the scheduled queue', 'workers_size' => 'Number of jobs actively being processed', }.freeze attr_reader :sidekiq_metrics, :gauges def initialize @sidekiq_metrics = [] @gauges = {} end def type 'sidekiq_stats' end def metrics sidekiq_metrics.map do |metric| SIDEKIQ_STATS_GAUGES.map do |name, help| if (value = metric['stats'][name]) gauge = gauges[name] ||= PrometheusExporter::Metric::Gauge.new("sidekiq_stats_#{name}", help) gauge.observe(value) end end end gauges.values end def collect(object) sidekiq_metrics << object end end end
Version data entries
7 entries across 7 versions & 1 rubygems