strongmind-sidekiq-cloudwatchmetrics 2.6.3 → 2.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sidekiq/cloud_watch_metrics.rb +15 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4583a94ad6b4bdd8cef65809d4be8856711c1da48237df304ae21719bc386672
|
4
|
+
data.tar.gz: e63191c5bd256155f648c9be25b66f4058d8801e9229227283ecfce3dbe29130
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d1b6346ce7e5119e27ba0bec11592c58e6b560a065e817ff1bbd2a21af30a56e46152caf4913fd52fd5bd10d9678a2147d4649c86e44f5b4e1607e2e615c32c
|
7
|
+
data.tar.gz: 2f36cddd1458bbf0c803c2c0067116f8bf15cd281b3be282f923eced9e96304b0e59c911c4ac578ec08d7142ff82ab9174b6bf5a813a50f957719b0ae4b3b13d
|
@@ -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: {},
|
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
|
|
@@ -223,17 +223,27 @@ module Sidekiq::CloudWatchMetrics
|
|
223
223
|
}
|
224
224
|
end
|
225
225
|
|
226
|
+
highest_latency_metric = metrics.max_by { |metric| metric[:value] }
|
227
|
+
metrics << {
|
228
|
+
metric_name: "MaxQueueLatency",
|
229
|
+
dimensions: [{name: "QueueName", value: "AllQueues"}],
|
230
|
+
timestamp: now,
|
231
|
+
value: highest_latency_metric[:value],
|
232
|
+
unit: "Seconds",
|
233
|
+
}
|
234
|
+
|
226
235
|
unless @additional_dimensions.empty?
|
227
236
|
metrics = metrics.each do |metric|
|
228
237
|
metric[:dimensions] = (metric[:dimensions] || []) + @additional_dimensions
|
229
238
|
end
|
230
239
|
end
|
231
|
-
|
232
240
|
# We can only put 20 metrics at a time
|
233
|
-
metrics.select { |metric| @metrics_to_publish.include?(metric[:metric_name]) }
|
241
|
+
custom_metrics = @metrics_to_publish&.any? ? metrics.select { |metric| @metrics_to_publish.include?(metric[:metric_name]) } : metrics
|
242
|
+
|
243
|
+
custom_metrics.each_slice(20) do |metric_to_publish|
|
234
244
|
@client.put_metric_data(
|
235
245
|
namespace: @namespace,
|
236
|
-
metric_data:
|
246
|
+
metric_data: metric_to_publish,
|
237
247
|
)
|
238
248
|
end
|
239
249
|
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.
|
4
|
+
version: 2.6.5
|
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-
|
11
|
+
date: 2024-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|