strongmind-sidekiq-cloudwatchmetrics 2.6.2 → 2.6.4

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
  SHA256:
3
- metadata.gz: b1a0c202a0fd5000413ce1ae2914676f329a03857d92cc6253bc8c96b84da96c
4
- data.tar.gz: d17aa4ac81a8fb976dcf1953298465ea8d5ff0090f91bb15695f05a45dc4a4c6
3
+ metadata.gz: 5fe6e911e4388260d1bf13674dce5e4ab6d3433799bfd2848186a43a2d67b809
4
+ data.tar.gz: a1c919b1af2905a9591a7aab9c79e691ba361fc286a311fd285e4b55ba252815
5
5
  SHA512:
6
- metadata.gz: 79d9b0f20ae97a0baa4f4e940c6b982c988de054b0a56a87ad2d17c6dc721ac15eeff4b6338fb794dd13404e5c978c8010feddbdd05eeaf2b6b25e2926654111
7
- data.tar.gz: d8d3fe1a146bfff8f43eb44af8d4b86475c82275cde99337083f0db6dd2bbd8ba961d32b73155ec5a8eea11f6696583a1fedcb5140ab88d847c699e8e6fe2662
6
+ metadata.gz: 48aa39fe0f573e0db86d27928efb73aeddec2058e24ed6bc8255164514ca128120ca8f548f6f53c3da4156016e577e723e90df32922700f412ead3a313f9890c
7
+ data.tar.gz: 58a0d087fa7575ad6935fc40f03b673595fb5338ea591e5ea97d4f64ccc8d699ed50515175d77ff68e26d9936ccf3a9e9d768d17c80ae8319499e7f5a6959017
@@ -42,7 +42,7 @@ module Sidekiq::CloudWatchMetrics
42
42
  include Sidekiq::Component
43
43
  end
44
44
 
45
- def initialize(config: Sidekiq, client: Aws::CloudWatch::Client.new, namespace: "Sidekiq", process_metrics: true, additional_dimensions: {}, metrics_to_publish: %w[EnqueuedJobs], interval: 60)
45
+ def initialize(config: Sidekiq, client: Aws::CloudWatch::Client.new(region: 'us-west-2'), namespace: ENV.fetch('NAMESPACE', 'Default-Sidekiq-CloudWatchMetrics'), process_metrics: true, additional_dimensions: {}, interval: 60, **kwargs)
46
46
  # Sidekiq 6.5+ requires @config, which defaults to the top-level
47
47
  # `Sidekiq` module, but can be overridden when running multiple Sidekiqs.
48
48
  @config = config
@@ -50,7 +50,7 @@ module Sidekiq::CloudWatchMetrics
50
50
  @namespace = namespace
51
51
  @process_metrics = process_metrics
52
52
  @additional_dimensions = additional_dimensions.map { |k, v| {name: k.to_s, value: v.to_s} }
53
- @metrics_to_publish = metrics_to_publish
53
+ @metrics_to_publish = kwargs[:metrics_to_publish] || []
54
54
  @interval = interval
55
55
  end
56
56
 
@@ -228,12 +228,13 @@ module Sidekiq::CloudWatchMetrics
228
228
  metric[:dimensions] = (metric[:dimensions] || []) + @additional_dimensions
229
229
  end
230
230
  end
231
-
232
231
  # We can only put 20 metrics at a time
233
- metrics.select { |metric| @metrics_to_publish.include?(metric[:metric_name]) }.each_slice(20) do |some_metrics|
232
+ custom_metrics = @metrics_to_publish&.any? ? metrics.select { |metric| @metrics_to_publish.include?(metric[:metric_name]) } : metrics
233
+
234
+ custom_metrics.each_slice(20) do |metric_to_publish|
234
235
  @client.put_metric_data(
235
236
  namespace: @namespace,
236
- metric_data: some_metrics,
237
+ metric_data: metric_to_publish,
237
238
  )
238
239
  end
239
240
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongmind-sidekiq-cloudwatchmetrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.2
4
+ version: 2.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - StrongMind Devops
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-23 00:00:00.000000000 Z
11
+ date: 2024-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq