Class: PrometheusExporter::Instrumentation::Resque
Class Method Summary
collapse
Instance Method Summary
collapse
started?, stop, worker_loop
Class Method Details
.start(client: nil, frequency: 30) ⇒ Object
6
7
8
9
10
11
12
13
|
# File 'lib/prometheus_exporter/instrumentation/resque.rb', line 6
def self.start(client: nil, frequency: 30)
resque_collector = new
client ||= PrometheusExporter::Client.default
worker_loop { client.send_json(resque_collector.collect) }
super
end
|
Instance Method Details
#collect ⇒ Object
15
16
17
18
19
20
|
# File 'lib/prometheus_exporter/instrumentation/resque.rb', line 15
def collect
metric = {}
metric[:type] = "resque"
collect_resque_stats(metric)
metric
end
|
#collect_resque_stats(metric) ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/prometheus_exporter/instrumentation/resque.rb', line 22
def collect_resque_stats(metric)
info = ::Resque.info
metric[:processed_jobs] = info[:processed]
metric[:failed_jobs] = info[:failed]
metric[:pending_jobs] = info[:pending]
metric[:queues] = info[:queues]
metric[:worker] = info[:workers]
metric[:working] = info[:working]
end
|