Class: PrometheusExporter::Instrumentation::SidekiqStats
- Inherits:
-
PeriodicStats
- Object
- PeriodicStats
- PrometheusExporter::Instrumentation::SidekiqStats
show all
- Defined in:
- lib/prometheus_exporter/instrumentation/sidekiq_stats.rb
Class Method Summary
collapse
Instance Method Summary
collapse
started?, stop, worker_loop
Class Method Details
.start(client: nil, frequency: 30) ⇒ Object
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/prometheus_exporter/instrumentation/sidekiq_stats.rb', line 5
def self.start(client: nil, frequency: 30)
client ||= PrometheusExporter::Client.default
sidekiq_stats_collector = new
worker_loop do
client.send_json(sidekiq_stats_collector.collect)
end
super
end
|
Instance Method Details
#collect ⇒ Object
16
17
18
19
20
21
|
# File 'lib/prometheus_exporter/instrumentation/sidekiq_stats.rb', line 16
def collect
{
type: 'sidekiq_stats',
stats: collect_stats
}
end
|
#collect_stats ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/prometheus_exporter/instrumentation/sidekiq_stats.rb', line 23
def collect_stats
stats = ::Sidekiq::Stats.new
{
'dead_size' => stats.dead_size,
'enqueued' => stats.enqueued,
'failed' => stats.failed,
'processed' => stats.processed,
'processes_size' => stats.processes_size,
'retry_size' => stats.retry_size,
'scheduled_size' => stats.scheduled_size,
'workers_size' => stats.workers_size,
}
end
|