strongmind-sidekiq-cloudwatchmetrics 2.6.3 → 2.6.4

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: ac9745ef50d718561a2ac4bacbde12d0c1fdff61fcfc76c9c2da90351268e547
4
- data.tar.gz: ed09f7b11b93e68b7c56fa413da9583beec3e938a3fd80b58ba46682bf57e0b8
3
+ metadata.gz: 5fe6e911e4388260d1bf13674dce5e4ab6d3433799bfd2848186a43a2d67b809
4
+ data.tar.gz: a1c919b1af2905a9591a7aab9c79e691ba361fc286a311fd285e4b55ba252815
5
5
  SHA512:
6
- metadata.gz: ae14804d758497fb7f0728127996cbad2e894c09a930e8ca82a9526a0fa29e4a7d655d1f045f70cb107ddc3e2993ee3f038a6a7cb82408e086721ea0fb646974
7
- data.tar.gz: 454e1398e39db0d2c406bd9647a4235093d2d5f3d93554ae2adea78b1829e03ae72958cb3c28752b7fa4d2e074583c5ee2427d3a8f9ec33d86a7101ca896b0d8
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(region: 'us-west-2'), namespace: ENV.fetch('NAMESPACE', 'Default-Sidekiq-CloudWatchMetrics'), 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.3
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