sidekiq-prometheus-exporter 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8500379e8abe15f6eb9680233e4a5c29367814f
4
- data.tar.gz: 024d07a212ce61766c3d9753d5e30d23eefea448
3
+ metadata.gz: 158112bb6619ff47bb38fd43801aaa1a01c95103
4
+ data.tar.gz: 99c35a1b67a403f17ee15eb4f576dcc6e30f8930
5
5
  SHA512:
6
- metadata.gz: e38cf453e888f26bd19e8eef17d1f2dd1187ad4dd790425c1dcbfe309a4c4efb0b207341bd23b364dba5dd6fced3967e00d73ade5f0cc88ceaceaf211438ee73
7
- data.tar.gz: 19d8fd0bcafc80ff5c032391bd80eb4a92b8427911153fef16a05f03b7d68959b801182e4a2c1841174e356c1c13aefe46987fe12d901e1d0c8528a3196a347a
6
+ metadata.gz: a5a4dcd286f353895888195d80e1a2c59a9142dc6a81e6b891d07cab307880e567a787892aa902a0bae7c549409663d9c56bfeb85ffffcc30e3e256a141356c7
7
+ data.tar.gz: 3fe0b5c64ff492697c149a13c68aea5fe0cad985d0e78c898047b2b6b876fb6fe559e3741114012aba377f66fab9dc993acf85570b0dbb7862c707c23c13ed6f
data/README.md CHANGED
@@ -22,15 +22,25 @@ Open [dashboard example file](/examples/sidekiq.json), then open `https://<your
22
22
  |-------------------------------------------|---------|-------------------------|
23
23
  | sidekiq_processed_jobs_total | counter | The total number of processed jobs
24
24
  | sidekiq_failed_jobs_total | counter | The total number of failed jobs
25
+ | sidekiq_workers | gauge | The number of workers across all the processes
26
+ | sidekiq_processes | gauge | The number of processes
25
27
  | sidekiq_busy_workers | gauge | The number of workers performing the job
26
28
  | sidekiq_enqueued_jobs | gauge | The number of enqueued jobs
27
29
  | sidekiq_scheduled_jobs | gauge | The number of jobs scheduled for a future execution
28
30
  | sidekiq_retry_jobs | gauge | The number of jobs scheduled for the next try
29
31
  | sidekiq_dead_jobs | gauge | The number of jobs being dead
30
- | sidekiq_queue_latency_seconds | gauge | The amount of seconds between oldest job being pushed to the queue and current time (labels: `name`)
31
- | sidekiq_queue_max_processing_time_seconds | gauge | The amount of seconds between oldest job of the queue being executed and current time (labels: `name`)
32
+ | sidekiq_queue_latency_seconds | gauge | The number of seconds between oldest job being pushed to the queue and current time (labels: `name`)
33
+ | sidekiq_queue_max_processing_time_seconds | gauge | The number of seconds between oldest job of the queue being executed and current time (labels: `name`)
32
34
  | sidekiq_queue_enqueued_jobs | gauge | The number of enqueued jobs in the queue (labels: `name`)
33
35
 
36
+ ### [Scheduler](https://github.com/moove-it/sidekiq-scheduler)
37
+
38
+ | Name | Type | Description |
39
+ |-----------------------------------------------|-------|-----------------------|
40
+ | sidekiq_scheduler_jobs | gauge | The number of recurring jobs
41
+ | sidekiq_scheduler_enabled_jobs | gauge | The number of enabled recurring jobs
42
+ | sidekiq_scheduler_time_since_last_run_minutes | gauge | The number of minutes since the last recurring job was executed and current time (labels: `name`)
43
+
34
44
  ### [Cron](https://github.com/ondrejbartas/sidekiq-cron)
35
45
 
36
46
  | Name | Type | Description |
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- sidekiq-prometheus-exporter (0.1.9)
4
+ sidekiq-prometheus-exporter (0.1.10)
5
5
  sidekiq (>= 3.3.1)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- sidekiq-prometheus-exporter (0.1.9)
4
+ sidekiq-prometheus-exporter (0.1.10)
5
5
  sidekiq (>= 3.3.1)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- sidekiq-prometheus-exporter (0.1.9)
4
+ sidekiq-prometheus-exporter (0.1.10)
5
5
  sidekiq (>= 3.3.1)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- sidekiq-prometheus-exporter (0.1.9)
4
+ sidekiq-prometheus-exporter (0.1.10)
5
5
  sidekiq (>= 3.3.1)
6
6
 
7
7
  GEM
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'sidekiq/prometheus/exporter/standard'
4
4
  require 'sidekiq/prometheus/exporter/cron'
5
+ require 'sidekiq/prometheus/exporter/scheduler'
5
6
 
6
7
  module Sidekiq
7
8
  module Prometheus
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'erb'
4
+ require 'time'
5
+
6
+ # Exporter for the https://github.com/moove-it/sidekiq-scheduler
7
+ module Sidekiq
8
+ module Prometheus
9
+ module Exporter
10
+ class Scheduler
11
+ TEMPLATE = ERB.new(File.read(File.expand_path('templates/scheduler.erb', __dir__)))
12
+ SECONDS_IN_MINUTE = 60
13
+ Stats = Struct.new(:jobs_count, :enabled_jobs_count, :last_runs)
14
+
15
+ def self.available?
16
+ defined?(Sidekiq::Scheduler)
17
+ end
18
+
19
+ def initialize
20
+ @stats = Stats.new(recurring_jobs.count, enabled_recurring_jobs.count, last_runs)
21
+ end
22
+
23
+ def to_s
24
+ TEMPLATE.result(binding).chomp!
25
+ end
26
+
27
+ private
28
+
29
+ def last_runs
30
+ enabled_recurring_jobs.each_with_object({}) do |name, memo|
31
+ execution_time = SidekiqScheduler::RedisManager.get_job_last_time(name)
32
+ next unless execution_time
33
+
34
+ memo[name] = (Time.now.to_i - Time.parse(execution_time).to_i) / SECONDS_IN_MINUTE
35
+ end
36
+ end
37
+
38
+ def enabled_recurring_jobs
39
+ recurring_jobs.select { |name| Sidekiq::Scheduler.job_enabled?(name) }
40
+ end
41
+
42
+ def recurring_jobs
43
+ @recurring_jobs ||= (Sidekiq.schedule! || {}).keys.sort
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,12 @@
1
+ # HELP sidekiq_scheduler_jobs The number of recurring jobs.
2
+ # TYPE sidekiq_scheduler_jobs gauge
3
+ sidekiq_scheduler_jobs <%= format('%d', @stats.jobs_count) %>
4
+
5
+ # HELP sidekiq_scheduler_enabled_jobs The number of enabled recurring jobs.
6
+ # TYPE sidekiq_scheduler_enabled_jobs gauge
7
+ sidekiq_scheduler_enabled_jobs <%= format('%d', @stats.enabled_jobs_count) %>
8
+
9
+ # HELP sidekiq_scheduler_time_since_last_run_minutes The number of minutes since the last recurring job was executed and current time.
10
+ # TYPE sidekiq_scheduler_time_since_last_run_minutes gauge
11
+ <% @stats.last_runs.each do |job, last_run_minutes| %>sidekiq_scheduler_time_since_last_run_minutes{name="<%= job %>"} <%= format('%i', last_run_minutes) %>
12
+ <% end %>
@@ -6,11 +6,11 @@ sidekiq_processed_jobs_total <%= format('%d', @overview_stats.processed) %>
6
6
  # TYPE sidekiq_failed_jobs_total counter
7
7
  sidekiq_failed_jobs_total <%= format('%d', @overview_stats.failed) %>
8
8
 
9
- # HELP sidekiq_workers The total number of workers across all the processes.
9
+ # HELP sidekiq_workers The number of workers across all the processes.
10
10
  # TYPE sidekiq_workers gauge
11
11
  sidekiq_workers <%= format('%d', @total_workers) %>
12
12
 
13
- # HELP sidekiq_processes The total number of processes.
13
+ # HELP sidekiq_processes The number of processes.
14
14
  # TYPE sidekiq_processes gauge
15
15
  sidekiq_processes <%= format('%d', @overview_stats.processes_size) %>
16
16
 
@@ -18,7 +18,7 @@ sidekiq_processes <%= format('%d', @overview_stats.processes_size) %>
18
18
  # TYPE sidekiq_busy_workers gauge
19
19
  sidekiq_busy_workers <%= format('%d', @overview_stats.workers_size) %>
20
20
 
21
- # HELP sidekiq_enqueued_jobs The total number of enqueued jobs.
21
+ # HELP sidekiq_enqueued_jobs The number of enqueued jobs.
22
22
  # TYPE sidekiq_enqueued_jobs gauge
23
23
  sidekiq_enqueued_jobs <%= format('%d', @overview_stats.enqueued) %>
24
24
 
@@ -34,7 +34,7 @@ sidekiq_retry_jobs <%= format('%d', @overview_stats.retry_size) %>
34
34
  # TYPE sidekiq_dead_jobs gauge
35
35
  sidekiq_dead_jobs <%= format('%d', @overview_stats.dead_size) %>
36
36
 
37
- # HELP sidekiq_queue_latency_seconds The amount of seconds between oldest job being pushed to the queue and current time.
37
+ # HELP sidekiq_queue_latency_seconds The number of seconds between oldest job being pushed to the queue and current time.
38
38
  # TYPE sidekiq_queue_latency_seconds gauge
39
39
  <% @queues_stats.each do |queue| %>sidekiq_queue_latency_seconds{name="<%= queue.name %>"} <%= format('%.3f', queue.latency) %>
40
40
  <% end %>
@@ -42,7 +42,7 @@ sidekiq_dead_jobs <%= format('%d', @overview_stats.dead_size) %>
42
42
  # TYPE sidekiq_queue_enqueued_jobs gauge
43
43
  <% @queues_stats.each do |queue| %>sidekiq_queue_enqueued_jobs{name="<%= queue.name %>"} <%= format('%d', queue.size) %>
44
44
  <% end %>
45
- # HELP sidekiq_queue_max_processing_time_seconds The amount of seconds between oldest job of the queue being executed and current time.
45
+ # HELP sidekiq_queue_max_processing_time_seconds The number of seconds between oldest job of the queue being executed and current time.
46
46
  # TYPE sidekiq_queue_max_processing_time_seconds gauge
47
47
  <% @max_processing_times.each do |queue, max_processing_time| %>sidekiq_queue_max_processing_time_seconds{name="<%= queue %>"} <%= format('%i', max_processing_time) %>
48
48
  <% end %>
@@ -3,7 +3,7 @@
3
3
  module Sidekiq
4
4
  module Prometheus
5
5
  module Exporter
6
- VERSION = '0.1.9'.freeze
6
+ VERSION = '0.1.10'.freeze
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-prometheus-exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Fedorov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-27 00:00:00.000000000 Z
11
+ date: 2019-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -203,8 +203,10 @@ files:
203
203
  - lib/sidekiq/prometheus/exporter.rb
204
204
  - lib/sidekiq/prometheus/exporter/cron.rb
205
205
  - lib/sidekiq/prometheus/exporter/exporters.rb
206
+ - lib/sidekiq/prometheus/exporter/scheduler.rb
206
207
  - lib/sidekiq/prometheus/exporter/standard.rb
207
208
  - lib/sidekiq/prometheus/exporter/templates/cron.erb
209
+ - lib/sidekiq/prometheus/exporter/templates/scheduler.erb
208
210
  - lib/sidekiq/prometheus/exporter/templates/standard.erb
209
211
  - lib/sidekiq/prometheus/exporter/version.rb
210
212
  - sidekiq-prometheus-exporter.gemspec