yabeda-sidekiq 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad8acaec8b59c1c088c6c924d5bbc777b1c87c346b56389045e4609b3920af11
4
- data.tar.gz: 26e87dbce002e1053eb6f5c709a78642b002691cad1f69e7d1d02722dd692790
3
+ metadata.gz: 3706bf67e5af718e54dc6c1d20c7a33c00296d0ce718b0bf5b089970cbe74ecc
4
+ data.tar.gz: 31452c0d618e80fef930974e8c7857a485f669a2cf453586a3fd0f4ed1968745
5
5
  SHA512:
6
- metadata.gz: 880a85b150e20c3b78a330d7fa9a2ae578d7fba140adaf9d01e8fdae467c57f746607efa601404b9b9f20d8bbf0fb98b560177ef198095fa48176f79ccc5ce10
7
- data.tar.gz: 720157c2e892d40ddd776e186055403d79162a8554c36a080003678f1f73d69a9cf924c5ef17bab42235b309506ef620eca80c6311e9af90f83b5c9460585d5a
6
+ metadata.gz: b9f047f8b9a1a0c4c397dd886bb7eee582b586da033bcd79c3038bc836257f8744734cd10340f918b3bf733a2679e58edb64e14d616945145b6f8bea692626b1
7
+ data.tar.gz: 7731398ecce804d79a9687e1cee1fe25f092485427e7ffea7d5d25422f34f5dbabc030f9cde726728300ab3068440093c774d0774868d97b5814df3c598cfd1c
data/CHANGELOG.md CHANGED
@@ -7,6 +7,46 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.13.0 - 2026-11-19
11
+
12
+ ### Added
13
+
14
+ - `buckets` configuration setting to customize buckets of `sidekiq_job_latency` and `sidekiq_job_runtime` histograms.
15
+
16
+ Pull request [#44](https://github.com/yabeda-rb/yabeda-sidekiq/pull/44) by [@CaseyDanger]
17
+
18
+ - `dead_segmented_by_queue` and `scheduled_segmented_by_queue` configuration settings to allow segmentation of dead and scheduled job counts by queue (like `retries_segmented_by_queue`).
19
+
20
+ When enabled, `queue` label is added to `sidekiq_jobs_dead_count` and `sidekiq_jobs_scheduled_count` metrics. They are disabled by default as they require to iterate over all jobs in dead or scheduled set and may be very slow if these sets are huge.
21
+
22
+ Pull request [#43](https://github.com/yabeda-rb/yabeda-sidekiq/pull/43) by [@duaasajid94]
23
+
24
+ - `filter_queues_by_current_process` configuration setting to collect per-queue cluster metrics only for queues that current Sidekiq process works on.
25
+
26
+ Applies to queue sizes, queue latencies, and retry/dead/scheduled job counts when they are segmented by queue. In Sidekiq 7+ queues of all capsules are taken into account. Useful when running multiple Sidekiq processes with different queue assignments and you want each process to report only its own queues. Do not enable in separate metric exporter processes.
27
+
28
+ Pull request [#41](https://github.com/yabeda-rb/yabeda-sidekiq/pull/41) by [@sobrinho]
29
+
30
+ ### Changed
31
+
32
+ - When retry, dead, or scheduled job counts are segmented by queue, gauges are now published for every known Sidekiq queue (reporting `0` for queues without jobs in the set), so a queue that has been emptied doesn't leave a stale series.
33
+
34
+ Pull request [#43](https://github.com/yabeda-rb/yabeda-sidekiq/pull/43) by [@duaasajid94]
35
+
36
+ ## 0.12.0 - 2024-03-08
37
+
38
+ ### Added
39
+
40
+ - Optional capture of error class for failed jobs counter.
41
+
42
+ Set `label_for_error_class_on_sidekiq_jobs_failed` to `true` to add `error` label to `sidekiq_jobs_failed_total` metric.
43
+
44
+ Pull request [#34](https://github.com/yabeda-rb/yabeda-sidekiq/pull/34) by [@niborg]
45
+
46
+ ### Changed
47
+
48
+ - Stop including development-related files into packaged gem to avoid confusing users or software tools. [@Envek]
49
+
10
50
  ## 0.11.0 - 2024-02-07
11
51
 
12
52
  ### Added
@@ -130,3 +170,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
130
170
  [@mrexox]: https://github.com/mrexox "Valentine Kiselev"
131
171
  [@LukinEgor]: https://github.com/LukinEgor "Egor Lukin"
132
172
  [@SxDx]: https://github.com/SxDx "René Koller"
173
+ [@niborg]: https://github.com/niborg "Nick Knipe"
174
+ [@sobrinho]: https://github.com/sobrinho "Gabriel Sobrinho"
175
+ [@CaseyDanger]: https://github.com/CaseyDanger "CaseyDanger"
176
+ [@duaasajid94]: https://github.com/duaasajid94 "duaasajid94"
data/README.md CHANGED
@@ -54,9 +54,9 @@ Metrics representing state of the whole Sidekiq installation (queues, processes,
54
54
 
55
55
  - Number of jobs in queues: `sidekiq_jobs_waiting_count` (segmented by queue)
56
56
  - Time of the queue latency `sidekiq_queue_latency` (the difference in seconds since the oldest job in the queue was enqueued)
57
- - Number of scheduled jobs:`sidekiq_jobs_scheduled_count`
58
- - Number of jobs in retry set: `sidekiq_jobs_retry_count`
59
- - Number of jobs in dead set (“morgue”): `sidekiq_jobs_dead_count`
57
+ - Number of scheduled jobs:`sidekiq_jobs_scheduled_count` (optionally segmented by queue)
58
+ - Number of jobs in retry set: `sidekiq_jobs_retry_count` (optionally segmented by queue)
59
+ - Number of jobs in dead set (“morgue”): `sidekiq_jobs_dead_count` (optionally segmented by queue)
60
60
  - Active processes count: `sidekiq_active_processes`
61
61
  - Active servers count: `sidekiq_active_workers_count`
62
62
 
@@ -66,9 +66,9 @@ By default all sidekiq worker processes (servers) collects global metrics about
66
66
 
67
67
  Metrics collected where jobs are being pushed to queues (everywhere):
68
68
 
69
- - Total number of enqueued jobs: `sidekiq_jobs_enqueued_total_count` (segmented by `queue` and `worker` class name)
69
+ - Total number of enqueued jobs: `sidekiq_jobs_enqueued_total` (segmented by `queue` and `worker` class name)
70
70
 
71
- - Total number of rerouted jobs: `sidekiq_jobs_rerouted_total_count` (segmented by origin queue `from_queue`, rerouted queue `to_queue`, and `worker` class name).
71
+ - Total number of rerouted jobs: `sidekiq_jobs_rerouted_total` (segmented by origin queue `from_queue`, rerouted queue `to_queue`, and `worker` class name).
72
72
 
73
73
  Rerouted jobs are jobs that on enqueue were pushed to different queue from the one specified in worker's `sidekiq_options`, most probably by some middleware.
74
74
 
@@ -99,17 +99,25 @@ end
99
99
 
100
100
  Configuration is handled by [anyway_config] gem. With it you can load settings from environment variables (upcased and prefixed with `YABEDA_SIDEKIQ_`), YAML files, and other sources. See [anyway_config] docs for details.
101
101
 
102
- Config key | Type | Default | Description |
103
- ---------------------------- | -------- | ------------------------------------------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------|
104
- `collect_cluster_metrics` | boolean | Enabled in Sidekiq worker processes, disabled otherwise | Defines whether this Ruby process should collect and expose metrics representing state of the whole Sidekiq installation (queues, processes, etc). |
105
- `declare_process_metrics` | boolean | Enabled in Sidekiq worker processes, disabled otherwise | Declare metrics that are only tracked inside worker process even outside of them. Useful for multiprocess metric collection. |
106
- `retries_segmented_by_queue` | boolean | Disabled | Defines wheter retries are segemented by queue or reported as a single metric |
102
+ | Config key | Type | Default | Description |
103
+ |------------------------------------------------|---------|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
104
+ | `collect_cluster_metrics` | boolean | Enabled in Sidekiq worker processes, disabled otherwise | Defines whether this Ruby process should collect and expose metrics representing state of the whole Sidekiq installation (queues, processes, etc). |
105
+ | `declare_process_metrics` | boolean | Enabled in Sidekiq worker processes, disabled otherwise | Declare metrics that are only tracked inside worker process even outside of them. Useful for multiprocess metric collection. |
106
+ | `retries_segmented_by_queue` | boolean | Disabled | Defines whether retries are segmented by queue or reported as a single metric. Iterates the retry set. |
107
+ | `dead_segmented_by_queue` | boolean | Disabled | Defines whether dead jobs are segmented by queue or reported as a single metric. Iterates the dead set. |
108
+ | `scheduled_segmented_by_queue` | boolean | Disabled | Defines whether scheduled jobs are segmented by queue or reported as a single metric. Iterates the scheduled set. |
109
+ | `filter_queues_by_current_process` | boolean | Disabled | Collect per-queue cluster metrics (queue sizes, latencies, segmented retry/dead/scheduled counts) only for queues this process works on (all capsules). |
110
+ | `label_for_error_class_on_sidekiq_jobs_failed` | boolean | Disabled | Defines whether `error` label should be added to `sidekiq_jobs_failed_total` metric. |
111
+ | `buckets` | array | `[0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 30, 60, 120, 300, 1800, 3600, 21600]` | Buckets for `sidekiq_job_latency` and `sidekiq_job_runtime` histograms (in seconds) |
107
112
 
108
- # Roadmap (TODO or Help wanted)
113
+ When any of the `*_segmented_by_queue` settings is enabled, that gauge is published for every known
114
+ Sidekiq queue plus any queue still present in the set, so emptied queues report `0` instead of disappearing.
109
115
 
110
- - Implement optional segmentation of schedule/dead sets
116
+ When `filter_queues_by_current_process` is enabled, only queues the current Sidekiq process is configured to work on
117
+ are reported (missing or empty ones as `0`). Note that in non-Sidekiq processes (e.g. a dedicated metrics exporter)
118
+ this is Sidekiq's default queue list (usually just `default`). Non-segmented totals and process/worker counts stay cluster-wide.
111
119
 
112
- It should be disabled by default as it requires to iterate over all jobs in sets and may be very slow on large sets.
120
+ # Roadmap (TODO or Help wanted)
113
121
 
114
122
  - Maybe add some hooks for ease of plugging in metrics for myriads of Sidekiq plugins?
115
123
 
@@ -4,6 +4,11 @@ require "anyway"
4
4
 
5
5
  module Yabeda
6
6
  module Sidekiq
7
+ LONG_RUNNING_JOB_RUNTIME_BUCKETS = [
8
+ 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, # standard (from Prometheus)
9
+ 30, 60, 120, 300, 1800, 3600, 21_600, # Sidekiq tasks may be very long-running
10
+ ].freeze
11
+
7
12
  class Config < ::Anyway::Config
8
13
  config_name :yabeda_sidekiq
9
14
 
@@ -20,6 +25,25 @@ module Yabeda
20
25
  # Retries are tracked by default as a single metric. If you want to track them separately for each queue, set this to +true+
21
26
  # Disabled by default because it is quite slow if the retry set is large
22
27
  attr_config retries_segmented_by_queue: false
28
+
29
+ # Dead jobs are tracked by default as a single metric. If you want to track them separately for each queue, set this to +true+
30
+ # Disabled by default because it is quite slow if the dead set is large
31
+ attr_config dead_segmented_by_queue: false
32
+
33
+ # Scheduled jobs are tracked by default as a single metric. If you want to track them separately for each queue, set this to +true+
34
+ # Disabled by default because it is quite slow if the scheduled set is large
35
+ attr_config scheduled_segmented_by_queue: false
36
+
37
+ # If set to true, an `:error` label will be added with name of the error class to all failed jobs
38
+ attr_config label_for_error_class_on_sidekiq_jobs_failed: false
39
+
40
+ # If set to true, per-queue cluster metrics (queue sizes, latencies, and segmented retry/dead/scheduled counts)
41
+ # are only collected for queues the current Sidekiq process works on (in all capsules) instead of all queues.
42
+ # Useful when different Sidekiq processes handle different queues and each should report only its own ones.
43
+ attr_config filter_queues_by_current_process: false
44
+
45
+ # Buckets for job_latency and job_runtime histograms
46
+ attr_config buckets: LONG_RUNNING_JOB_RUNTIME_BUCKETS
23
47
  end
24
48
  end
25
49
  end
@@ -7,7 +7,7 @@ module Yabeda
7
7
  # See https://github.com/mperham/sidekiq/discussions/4971
8
8
  JOB_RECORD_CLASS = defined?(::Sidekiq::JobRecord) ? ::Sidekiq::JobRecord : ::Sidekiq::Job
9
9
 
10
- # rubocop: disable Metrics/AbcSize, Metrics/MethodLength:
10
+ # rubocop: disable Metrics/AbcSize, Metrics/MethodLength
11
11
  def call(worker, job, queue)
12
12
  custom_tags = Yabeda::Sidekiq.custom_tags(worker, job).to_h
13
13
  labels = Yabeda::Sidekiq.labelize(worker, job, queue).merge(custom_tags)
@@ -20,8 +20,10 @@ module Yabeda
20
20
  yield
21
21
  end
22
22
  Yabeda.sidekiq_jobs_success_total.increment(labels)
23
- rescue Exception # rubocop: disable Lint/RescueException
24
- Yabeda.sidekiq_jobs_failed_total.increment(labels)
23
+ rescue Exception => e # rubocop: disable Lint/RescueException
24
+ jobs_failed_labels = labels.dup
25
+ jobs_failed_labels[:error] = e.class.name if Yabeda::Sidekiq.config.label_for_error_class_on_sidekiq_jobs_failed
26
+ Yabeda.sidekiq_jobs_failed_total.increment(jobs_failed_labels)
25
27
  raise
26
28
  ensure
27
29
  Yabeda.sidekiq_job_runtime.measure(labels, elapsed(start))
@@ -29,7 +31,7 @@ module Yabeda
29
31
  Yabeda::Sidekiq.jobs_started_at[labels].delete(job["jid"])
30
32
  end
31
33
  end
32
- # rubocop: enable Metrics/AbcSize, Metrics/MethodLength:
34
+ # rubocop: enable Metrics/AbcSize, Metrics/MethodLength
33
35
 
34
36
  private
35
37
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yabeda
4
4
  module Sidekiq
5
- VERSION = "0.11.0"
5
+ VERSION = "0.13.0"
6
6
  end
7
7
  end
@@ -11,11 +11,6 @@ require "yabeda/sidekiq/config"
11
11
 
12
12
  module Yabeda
13
13
  module Sidekiq
14
- LONG_RUNNING_JOB_RUNTIME_BUCKETS = [
15
- 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, # standard (from Prometheus)
16
- 30, 60, 120, 300, 1800, 3600, 21_600, # Sidekiq tasks may be very long-running
17
- ].freeze
18
-
19
14
  def self.config
20
15
  @config ||= Config.new
21
16
  end
@@ -29,9 +24,11 @@ module Yabeda
29
24
  counter :jobs_rerouted_total, tags: %i[from_queue to_queue worker], comment: "A counter of the total number of rerouted jobs sidekiq enqueued."
30
25
 
31
26
  if config.declare_process_metrics # defaults to +::Sidekiq.server?+
27
+ failed_total_tags = config.label_for_error_class_on_sidekiq_jobs_failed ? %i[queue worker error] : %i[queue worker]
28
+
32
29
  counter :jobs_executed_total, tags: %i[queue worker], comment: "A counter of the total number of jobs sidekiq executed."
33
30
  counter :jobs_success_total, tags: %i[queue worker], comment: "A counter of the total number of jobs successfully processed by sidekiq."
34
- counter :jobs_failed_total, tags: %i[queue worker], comment: "A counter of the total number of jobs failed in sidekiq."
31
+ counter :jobs_failed_total, tags: failed_total_tags, comment: "A counter of the total number of jobs failed in sidekiq."
35
32
 
36
33
  gauge :running_job_runtime, tags: %i[queue worker], aggregation: :max, unit: :seconds,
37
34
  comment: "How long currently running jobs are running (useful for detection of hung jobs)"
@@ -39,26 +36,28 @@ module Yabeda
39
36
  histogram :job_latency, comment: "The job latency, the difference in seconds between enqueued and running time",
40
37
  unit: :seconds, per: :job,
41
38
  tags: %i[queue worker],
42
- buckets: LONG_RUNNING_JOB_RUNTIME_BUCKETS
39
+ buckets: config.buckets
43
40
  histogram :job_runtime, comment: "A histogram of the job execution time.",
44
41
  unit: :seconds, per: :job,
45
42
  tags: %i[queue worker],
46
- buckets: LONG_RUNNING_JOB_RUNTIME_BUCKETS
43
+ buckets: config.buckets
47
44
  end
48
45
 
49
46
  # Metrics not specific for current Sidekiq process, but representing state of the whole Sidekiq installation (queues, processes, etc)
50
47
  # You can opt-out from collecting these by setting YABEDA_SIDEKIQ_COLLECT_CLUSTER_METRICS to falsy value (+no+ or +false+)
51
48
  if config.collect_cluster_metrics # defaults to +::Sidekiq.server?+
52
49
  retry_count_tags = config.retries_segmented_by_queue ? %i[queue] : []
50
+ dead_count_tags = config.dead_segmented_by_queue ? %i[queue] : []
51
+ scheduled_count_tags = config.scheduled_segmented_by_queue ? %i[queue] : []
53
52
 
54
- gauge :jobs_waiting_count, tags: %i[queue], aggregation: :most_recent, comment: "The number of jobs waiting to process in sidekiq."
55
- gauge :active_workers_count, tags: [], aggregation: :most_recent,
53
+ gauge :jobs_waiting_count, tags: %i[queue], aggregation: :most_recent, comment: "The number of jobs waiting to process in sidekiq."
54
+ gauge :active_workers_count, tags: [], aggregation: :most_recent,
56
55
  comment: "The number of currently running machines with sidekiq workers."
57
- gauge :jobs_scheduled_count, tags: [], aggregation: :most_recent, comment: "The number of jobs scheduled for later execution."
58
- gauge :jobs_retry_count, tags: retry_count_tags, aggregation: :most_recent, comment: "The number of failed jobs waiting to be retried"
59
- gauge :jobs_dead_count, tags: [], aggregation: :most_recent, comment: "The number of jobs exceeded their retry count."
60
- gauge :active_processes, tags: [], aggregation: :most_recent, comment: "The number of active Sidekiq worker processes."
61
- gauge :queue_latency, tags: %i[queue], aggregation: :most_recent,
56
+ gauge :jobs_scheduled_count, tags: scheduled_count_tags, aggregation: :most_recent, comment: "The number of jobs scheduled for later execution."
57
+ gauge :jobs_retry_count, tags: retry_count_tags, aggregation: :most_recent, comment: "The number of failed jobs waiting to be retried"
58
+ gauge :jobs_dead_count, tags: dead_count_tags, aggregation: :most_recent, comment: "The number of jobs exceeded their retry count."
59
+ gauge :active_processes, tags: [], aggregation: :most_recent, comment: "The number of active Sidekiq worker processes."
60
+ gauge :queue_latency, tags: %i[queue], aggregation: :most_recent,
62
61
  comment: "The queue latency, the difference in seconds since the oldest job in the queue was enqueued"
63
62
  end
64
63
 
@@ -68,30 +67,38 @@ module Yabeda
68
67
  next unless config.collect_cluster_metrics
69
68
 
70
69
  stats = ::Sidekiq::Stats.new
70
+ process_queues = Yabeda::Sidekiq.process_queue_names if config.filter_queues_by_current_process
71
+ queue_sizes = stats.queues
72
+ queue_sizes = process_queues.to_h { |name| [name, queue_sizes.fetch(name, 0)] } if process_queues
71
73
 
72
- stats.queues.each do |k, v|
74
+ queue_sizes.each do |k, v|
73
75
  sidekiq_jobs_waiting_count.set({ queue: k }, v)
74
76
  end
75
77
  sidekiq_active_workers_count.set({}, stats.workers_size)
76
- sidekiq_jobs_scheduled_count.set({}, stats.scheduled_size)
77
- sidekiq_jobs_dead_count.set({}, stats.dead_size)
78
78
  sidekiq_active_processes.set({}, stats.processes_size)
79
79
 
80
- ::Sidekiq::Queue.all.each do |queue|
80
+ queues = process_queues ? process_queues.map { |name| ::Sidekiq::Queue.new(name) } : ::Sidekiq::Queue.all
81
+ queues.each do |queue|
81
82
  sidekiq_queue_latency.set({ queue: queue.name }, queue.latency)
82
83
  end
83
84
 
84
85
  if config.retries_segmented_by_queue
85
- retries_by_queues =
86
- ::Sidekiq::RetrySet.new.each_with_object(Hash.new(0)) do |job, cntr|
87
- cntr[job["queue"]] += 1
88
- end
89
- retries_by_queues.each do |queue, count|
90
- sidekiq_jobs_retry_count.set({ queue: queue }, count)
91
- end
86
+ Yabeda::Sidekiq.set_jobs_count_by_queue(sidekiq_jobs_retry_count, ::Sidekiq::RetrySet.new, queue_sizes.keys)
92
87
  else
93
88
  sidekiq_jobs_retry_count.set({}, stats.retry_size)
94
89
  end
90
+
91
+ if config.dead_segmented_by_queue
92
+ Yabeda::Sidekiq.set_jobs_count_by_queue(sidekiq_jobs_dead_count, ::Sidekiq::DeadSet.new, queue_sizes.keys)
93
+ else
94
+ sidekiq_jobs_dead_count.set({}, stats.dead_size)
95
+ end
96
+
97
+ if config.scheduled_segmented_by_queue
98
+ Yabeda::Sidekiq.set_jobs_count_by_queue(sidekiq_jobs_scheduled_count, ::Sidekiq::ScheduledSet.new, queue_sizes.keys)
99
+ else
100
+ sidekiq_jobs_scheduled_count.set({}, stats.scheduled_size)
101
+ end
95
102
  end
96
103
  end
97
104
 
@@ -139,6 +146,28 @@ module Yabeda
139
146
  Yabeda.sidekiq.running_job_runtime.set(labels, oldest_job_duration)
140
147
  end
141
148
  end
149
+
150
+ # Counts jobs in a Sidekiq job set (retry, dead, scheduled) per queue.
151
+ # Known queues without jobs in the set are reported as zero, so their series don't go stale.
152
+ # Queues present only in the set (e.g. removed ones) are reported too, unless filtering by current process.
153
+ def set_jobs_count_by_queue(metric, job_set, known_queues)
154
+ counts = job_set.each_with_object(Hash.new(0)) { |job, cntr| cntr[job["queue"]] += 1 }
155
+ queues = config.filter_queues_by_current_process ? known_queues : known_queues | counts.keys
156
+ queues.each { |queue| metric.set({ queue: queue }, counts[queue]) }
157
+ end
158
+
159
+ # Names of queues the current process is configured to work on (across all capsules).
160
+ def process_queue_names
161
+ queues =
162
+ if ::Sidekiq.respond_to?(:default_configuration) # Sidekiq 7+
163
+ ::Sidekiq.default_configuration.capsules.values.flat_map(&:queues)
164
+ elsif ::Sidekiq.respond_to?(:[]) # Sidekiq 6.5+
165
+ ::Sidekiq[:queues]
166
+ else # Sidekiq 5.x – 6.4
167
+ ::Sidekiq.options[:queues]
168
+ end
169
+ queues.uniq # weighted queues are listed multiple times
170
+ end
142
171
  end
143
172
 
144
173
  self.jobs_started_at = Concurrent::Map.new { |hash, key| hash[key] = Concurrent::Map.new }
@@ -15,8 +15,14 @@ Gem::Specification.new do |spec|
15
15
  spec.homepage = "https://github.com/yabeda-rb/yabeda-sidekiq"
16
16
  spec.license = "MIT"
17
17
 
18
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
- f.match(%r{^(test|spec|features)/})
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = spec.homepage
20
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
21
+ spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
22
+ spec.metadata["rubygems_mfa_required"] = "true"
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
25
+ f.match(%r{^(\.|bin/|spec/|tmp/|Gemfile|Rakefile|yabeda-sidekiq-logo\.png)})
20
26
  end
21
27
  spec.bindir = "exe"
22
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -27,7 +33,7 @@ Gem::Specification.new do |spec|
27
33
  spec.add_dependency "yabeda", "~> 0.6"
28
34
 
29
35
  spec.add_development_dependency "activejob", ">= 6.0"
30
- spec.add_development_dependency "bundler", "~> 2.0"
36
+ spec.add_development_dependency "bundler", ">= 2.0"
31
37
  spec.add_development_dependency "rake", "~> 13.0"
32
38
  spec.add_development_dependency "rspec", "~> 3.0"
33
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Novikov
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-07 00:00:00.000000000 Z
11
+ date: 2026-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anyway_config
@@ -76,14 +76,14 @@ dependencies:
76
76
  name: bundler
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - "~>"
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: '2.0'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - "~>"
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '2.0'
89
89
  - !ruby/object:Gem::Dependency
@@ -122,31 +122,25 @@ executables: []
122
122
  extensions: []
123
123
  extra_rdoc_files: []
124
124
  files:
125
- - ".github/workflows/lint.yml"
126
- - ".github/workflows/release.yml"
127
- - ".github/workflows/test.yml"
128
- - ".gitignore"
129
- - ".rspec"
130
- - ".rubocop.yml"
131
125
  - CHANGELOG.md
132
- - Gemfile
133
126
  - LICENSE.txt
134
127
  - README.md
135
- - Rakefile
136
- - bin/console
137
- - bin/setup
138
128
  - lib/yabeda/sidekiq.rb
139
129
  - lib/yabeda/sidekiq/client_middleware.rb
140
130
  - lib/yabeda/sidekiq/config.rb
141
131
  - lib/yabeda/sidekiq/server_middleware.rb
142
132
  - lib/yabeda/sidekiq/version.rb
143
- - yabeda-sidekiq-logo.png
144
133
  - yabeda-sidekiq.gemspec
145
134
  homepage: https://github.com/yabeda-rb/yabeda-sidekiq
146
135
  licenses:
147
136
  - MIT
148
- metadata: {}
149
- post_install_message:
137
+ metadata:
138
+ homepage_uri: https://github.com/yabeda-rb/yabeda-sidekiq
139
+ source_code_uri: https://github.com/yabeda-rb/yabeda-sidekiq
140
+ changelog_uri: https://github.com/yabeda-rb/yabeda-sidekiq/blob/master/CHANGELOG.md
141
+ bug_tracker_uri: https://github.com/yabeda-rb/yabeda-sidekiq/issues
142
+ rubygems_mfa_required: 'true'
143
+ post_install_message:
150
144
  rdoc_options: []
151
145
  require_paths:
152
146
  - lib
@@ -161,8 +155,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
155
  - !ruby/object:Gem::Version
162
156
  version: '0'
163
157
  requirements: []
164
- rubygems_version: 3.5.3
165
- signing_key:
158
+ rubygems_version: 3.5.22
159
+ signing_key:
166
160
  specification_version: 4
167
161
  summary: Extensible Prometheus exporter for monitoring your Sidekiq
168
162
  test_files: []
@@ -1,25 +0,0 @@
1
- name: Lint
2
-
3
- on:
4
- pull_request:
5
- push:
6
- branches:
7
- - '**'
8
- tags-ignore:
9
- - 'v*'
10
-
11
- jobs:
12
- rubocop:
13
- # Skip running tests for local pull requests (use push event instead), run only for foreign ones
14
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
15
- name: RuboCop
16
- runs-on: ubuntu-latest
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: ruby/setup-ruby@v1
20
- with:
21
- ruby-version: "3.2"
22
- bundler-cache: true
23
- - name: Lint Ruby code with RuboCop
24
- run: |
25
- bundle exec rubocop
@@ -1,86 +0,0 @@
1
- name: Build and release gem
2
-
3
- on:
4
- push:
5
- tags:
6
- - v*
7
-
8
- jobs:
9
- release:
10
- runs-on: ubuntu-latest
11
- permissions:
12
- contents: write
13
- id-token: write
14
- packages: write
15
- steps:
16
- - uses: actions/checkout@v4
17
- with:
18
- fetch-depth: 0 # Fetch current tag as annotated. See https://github.com/actions/checkout/issues/290
19
- - uses: ruby/setup-ruby@v1
20
- with:
21
- ruby-version: "3.3"
22
- - name: "Extract data from tag: version, message, body"
23
- id: tag
24
- run: |
25
- git fetch --tags --force # Really fetch annotated tag. See https://github.com/actions/checkout/issues/290#issuecomment-680260080
26
- echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
27
- echo ::set-output name=subject::$(git for-each-ref $GITHUB_REF --format='%(contents:subject)')
28
- BODY="$(git for-each-ref $GITHUB_REF --format='%(contents:body)')"
29
- # Extract changelog entries between this and previous version headers
30
- escaped_version=$(echo ${GITHUB_REF#refs/tags/v} | sed -e 's/[]\/$*.^[]/\\&/g')
31
- changelog=$(awk "BEGIN{inrelease=0} /## ${escaped_version}/{inrelease=1;next} /## [0-9]+\.[0-9]+\.[0-9]+/{inrelease=0;exit} {if (inrelease) print}" CHANGELOG.md)
32
- # Multiline body for release. See https://github.community/t/set-output-truncates-multiline-strings/16852/5
33
- BODY="${BODY}"$'\n'"${changelog}"
34
- BODY="${BODY//'%'/'%25'}"
35
- BODY="${BODY//$'\n'/'%0A'}"
36
- BODY="${BODY//$'\r'/'%0D'}"
37
- echo "::set-output name=body::$BODY"
38
- # Add pre-release option if tag name has any suffix after vMAJOR.MINOR.PATCH
39
- if [[ ${GITHUB_REF#refs/tags/} =~ ^v[0-9]+\.[0-9]+\.[0-9]+.+ ]]; then
40
- echo ::set-output name=prerelease::true
41
- fi
42
- - name: Build gem
43
- run: gem build
44
- - name: Calculate checksums
45
- run: sha256sum yabeda-sidekiq-${{ steps.tag.outputs.version }}.gem > SHA256SUM
46
- - name: Check version
47
- run: ls -l yabeda-sidekiq-${{ steps.tag.outputs.version }}.gem
48
- - name: Create Release
49
- id: create_release
50
- uses: actions/create-release@v1
51
- env:
52
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53
- with:
54
- tag_name: ${{ github.ref }}
55
- release_name: ${{ steps.tag.outputs.subject }}
56
- body: ${{ steps.tag.outputs.body }}
57
- draft: false
58
- prerelease: ${{ steps.tag.outputs.prerelease }}
59
- - name: Upload built gem as release asset
60
- uses: actions/upload-release-asset@v1
61
- env:
62
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63
- with:
64
- upload_url: ${{ steps.create_release.outputs.upload_url }}
65
- asset_path: yabeda-sidekiq-${{ steps.tag.outputs.version }}.gem
66
- asset_name: yabeda-sidekiq-${{ steps.tag.outputs.version }}.gem
67
- asset_content_type: application/x-tar
68
- - name: Upload checksums as release asset
69
- uses: actions/upload-release-asset@v1
70
- env:
71
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72
- with:
73
- upload_url: ${{ steps.create_release.outputs.upload_url }}
74
- asset_path: SHA256SUM
75
- asset_name: SHA256SUM
76
- asset_content_type: text/plain
77
- - name: Publish to GitHub packages
78
- env:
79
- GEM_HOST_API_KEY: Bearer ${{ secrets.GITHUB_TOKEN }}
80
- run: |
81
- gem push yabeda-sidekiq-${{ steps.tag.outputs.version }}.gem --host https://rubygems.pkg.github.com/${{ github.repository_owner }}
82
- - name: Configure RubyGems Credentials
83
- uses: rubygems/configure-rubygems-credentials@main
84
- - name: Publish to RubyGems
85
- run: |
86
- gem push yabeda-sidekiq-${{ steps.tag.outputs.version }}.gem
@@ -1,43 +0,0 @@
1
- name: Tests
2
-
3
- on:
4
- pull_request:
5
- push:
6
- branches:
7
- - '**'
8
- tags-ignore:
9
- - 'v*'
10
-
11
- jobs:
12
- test:
13
- name: 'Ruby ${{ matrix.ruby }} × Sidekiq v${{ matrix.sidekiq }} × ActiveJob v${{ matrix.activejob }}'
14
- # Skip running tests for local pull requests (use push event instead), run only for foreign ones
15
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
16
- runs-on: ubuntu-latest
17
- strategy:
18
- fail-fast: false
19
- matrix:
20
- include:
21
- - ruby: '3.3'
22
- sidekiq: '7'
23
- activejob: '7.1'
24
- - ruby: '3.2'
25
- sidekiq: '7'
26
- activejob: '7.0'
27
- - ruby: '3.1'
28
- sidekiq: '6'
29
- activejob: '6.1'
30
- - ruby: '3.0'
31
- sidekiq: '5'
32
- activejob: '6.0'
33
- env:
34
- SIDEKIQ_VERSION: '${{ matrix.sidekiq }}'
35
- ACTIVEJOB_VERSION: '${{ matrix.activejob }}'
36
- steps:
37
- - uses: actions/checkout@v4
38
- - uses: ruby/setup-ruby@v1
39
- with:
40
- ruby-version: ${{ matrix.ruby }}
41
- bundler-cache: true
42
- - name: Run RSpec
43
- run: bundle exec rspec
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- Gemfile.lock
10
-
11
- # rspec failure tracking
12
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,79 +0,0 @@
1
- ---
2
- require:
3
- - rubocop-rspec
4
-
5
- AllCops:
6
- TargetRubyVersion: 2.5
7
-
8
- Metrics/BlockLength:
9
- Enabled: false
10
- Exclude:
11
- - "Gemfile"
12
- - "spec/**/*"
13
-
14
- Layout/LineLength:
15
- Max: 160
16
-
17
- Style/StringLiterals:
18
- EnforcedStyle: double_quotes
19
-
20
- # Allow to use let!
21
- RSpec/LetSetup:
22
- Enabled: false
23
-
24
- RSpec/MultipleExpectations:
25
- Enabled: false
26
-
27
- Bundler/OrderedGems:
28
- Enabled: false
29
-
30
- Style/TrailingCommaInArguments:
31
- Description: 'Checks for trailing comma in argument lists.'
32
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-params-comma'
33
- Enabled: true
34
- EnforcedStyleForMultiline: consistent_comma
35
-
36
- Style/TrailingCommaInArrayLiteral:
37
- Description: 'Checks for trailing comma in array literals.'
38
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
39
- Enabled: true
40
- EnforcedStyleForMultiline: consistent_comma
41
-
42
- Style/TrailingCommaInHashLiteral:
43
- Description: 'Checks for trailing comma in hash literals.'
44
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
45
- Enabled: true
46
- EnforcedStyleForMultiline: consistent_comma
47
-
48
- Style/HashEachMethods:
49
- Enabled: true
50
-
51
- Style/HashTransformKeys:
52
- Enabled: true
53
-
54
- Style/HashTransformValues:
55
- Enabled: true
56
-
57
- RSpec/ExampleLength:
58
- Enabled: false
59
-
60
- Style/Documentation:
61
- Enabled: false
62
-
63
- Metrics/MethodLength:
64
- Max: 15
65
-
66
- Metrics/AbcSize:
67
- Max: 17
68
-
69
- Style/SoleNestedConditional:
70
- Enabled: false
71
-
72
- Style/ExplicitBlockArgument:
73
- Enabled: false
74
-
75
- Gemspec/RequiredRubyVersion:
76
- Enabled: false
77
-
78
- Metrics/ModuleLength:
79
- Max: 200
data/Gemfile DELETED
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
-
7
- # Specify your gem's dependencies in yabeda-sidekiq.gemspec
8
- gemspec
9
-
10
- # rubocop:disable Bundler/DuplicatedGem
11
- sidekiq_version = ENV.fetch("SIDEKIQ_VERSION", "~> 7.2")
12
- case sidekiq_version
13
- when "HEAD"
14
- gem "sidekiq", git: "https://github.com/sidekiq/sidekiq.git"
15
- else
16
- sidekiq_version = "~> #{sidekiq_version}.0" if sidekiq_version.match?(/^\d+(?:\.\d+)?$/)
17
- gem "sidekiq", sidekiq_version
18
- end
19
-
20
- activejob_version = ENV.fetch("ACTIVEJOB_VERSION", "~> 7.1")
21
- case activejob_version
22
- when "HEAD"
23
- git "https://github.com/rails/rails.git" do
24
- gem "activejob"
25
- gem "activesupport"
26
- gem "rails"
27
- end
28
- else
29
- activejob_version = "~> #{activejob_version}.0" if activejob_version.match?(/^\d+\.\d+$/)
30
- gem "activejob", activejob_version
31
- gem "activesupport", activejob_version
32
- end
33
- # rubocop:enable Bundler/DuplicatedGem
34
-
35
- group :development, :test do
36
- gem "pry"
37
- gem "pry-byebug", platform: :mri
38
-
39
- gem "yabeda", github: "yabeda-rb/yabeda", branch: "master" # For RSpec matchers
40
- gem "rubocop", "~> 1.0"
41
- gem "rubocop-rspec"
42
- end
data/Rakefile DELETED
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
- require "rubocop/rake_task"
6
-
7
- RuboCop::RakeTask.new
8
-
9
- RSpec::Core::RakeTask.new(:spec)
10
-
11
- task default: %i[rubocop spec]
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "yabeda/sidekiq"
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "irb"
15
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
Binary file