sidekiq-cloudwatchmetrics 1.1.0 → 1.2.0

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: 8e3991b16a0ac40b697bd24d4efee3192a8d9bb5ca4c252e2f5cd6135843800d
4
- data.tar.gz: 53107e6b0601740c0133b1f95396863cb3853d46628d2b4f575102aa496d4110
3
+ metadata.gz: d53e441eb20e71675c81b6992fcc9ec0ef3ecdaf997ca1e10b215964146172a6
4
+ data.tar.gz: d1a7a8a295510bb06950fc74a1d183a4dbc8143d493f9f6e780005c30bba68a7
5
5
  SHA512:
6
- metadata.gz: 24311c4a2dca677378aa1a0b44ed33e7957b2e445c9ea39a20de21efb30acf8fc388912a9805c59651d44b822a25205a23f87d85f692d64489d020f29b6f8275
7
- data.tar.gz: 188acd1c12c6b69315fb17b778ba9e56dadf7e1d05c8af0b8eb84dcddf48ce30cb9bae795ee266a60f0a0fdef1982081b0e0c3eb5cf850e310194ef296457b17
6
+ metadata.gz: 78058528022016d9093e2de8be2d76671cab60c09b3d216b9a6d32eaa37e734445362ae72f216902208576a2902d88037ba64844ea7d48460e273b23792b4535
7
+ data.tar.gz: 68d5614a0e84a49ef4113ab0bc3d95429efc9dc9980868efb329b339984d2a4b7fdcca1fd921a3befd7544fce5d8530777c180741871b5be20c0ff0c370001fb
data/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  # Sidekiq CloudWatch Metrics
2
2
 
3
+ [![Build Status](https://travis-ci.org/sj26/sidekiq-cloudwatchmetrics.svg)](https://travis-ci.org/sj26/sidekiq-cloudwatchmetrics)
4
+
3
5
  Runs a thread inside your Sidekiq processes to report metrics to CloudWatch
4
6
  useful for autoscaling and keeping an eye on your queues.
5
7
 
6
8
  Optimised for Sidekiq Enterprise with leader election, but works everywhere!
7
9
 
10
+ <img width="1055" alt="Screenshot of Sidekiq metrics in a CloudWatch dashboard" src="https://user-images.githubusercontent.com/14028/44190767-9fd66280-a16b-11e8-8b12-3d5e0641c15f.png">
11
+
8
12
  ## Installation
9
13
 
10
14
  Add this gem to your application’s Gemfile near sidekiq and then run `bundle install`:
@@ -38,8 +38,9 @@ module Sidekiq::CloudWatchMetrics
38
38
 
39
39
  INTERVAL = 60 # seconds
40
40
 
41
- def initialize(client: Aws::CloudWatch::Client.new)
41
+ def initialize(client: Aws::CloudWatch::Client.new, additional_dimensions: {})
42
42
  @client = client
43
+ @additional_dimensions = additional_dimensions.map { |k, v| {name: k.to_s, value: v.to_s} }
43
44
  end
44
45
 
45
46
  def start
@@ -176,6 +177,12 @@ module Sidekiq::CloudWatchMetrics
176
177
  }
177
178
  end
178
179
 
180
+ unless @additional_dimensions.empty?
181
+ metrics = metrics.each do |metric|
182
+ metric[:dimensions] = (metric[:dimensions] || []) + @additional_dimensions
183
+ end
184
+ end
185
+
179
186
  # We can only put 20 metrics at a time
180
187
  metrics.each_slice(20) do |some_metrics|
181
188
  @client.put_metric_data(
@@ -209,6 +216,9 @@ module Sidekiq::CloudWatchMetrics
209
216
  @stop = true
210
217
  @thread.wakeup
211
218
  @thread.join
219
+ rescue ThreadError
220
+ # Don't raise if thread is already dead.
221
+ nil
212
222
  end
213
223
  end
214
224
  end
metadata CHANGED
@@ -1,34 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-cloudwatchmetrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Cochran
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDKDCCAhCgAwIBAgIBBjANBgkqhkiG9w0BAQsFADA6MQ0wCwYDVQQDDARzajI2
14
- MRQwEgYKCZImiZPyLGQBGRYEc2oyNjETMBEGCgmSJomT8ixkARkWA2NvbTAeFw0x
15
- ODA4MTYwNTE4NDBaFw0xOTA4MTYwNTE4NDBaMDoxDTALBgNVBAMMBHNqMjYxFDAS
16
- BgoJkiaJk/IsZAEZFgRzajI2MRMwEQYKCZImiZPyLGQBGRYDY29tMIIBIjANBgkq
17
- hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsr60Eo/ttCk8GMTMFiPr3GoYMIMFvLak
18
- xSmTk9YGCB6UiEePB4THSSA5w6IPyeaCF/nWkDp3/BAam0eZMWG1IzYQB23TqIM0
19
- 1xzcNRvFsn0aQoQ00k+sj+G83j3T5OOV5OZIlu8xAChMkQmiPd1NXc6uFv+Iacz7
20
- kj+CMsI9YUFdNoU09QY0b+u+Rb6wDYdpyvN60YC30h0h1MeYbvYZJx/iZK4XY5zu
21
- 4O/FL2ChjL2CPCpLZW55ShYyrzphWJwLOJe+FJ/ZBl6YXwrzQM9HKnt4titSNvyU
22
- KzE3L63A3PZvExzLrN9u09kuWLLJfXB2sGOlw3n9t72rJiuBr3/OQQIDAQABozkw
23
- NzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU99dfRjEKFyczTeIz
24
- m3ZsDWrNC80wDQYJKoZIhvcNAQELBQADggEBAEwUQFizoyvm/1/iX8i/+oK6hr5m
25
- wd7ZEzIV32JRyaqkPFeWjBylRXZyoXsE2u1H9ofIw8b/5/M+uMIfR8jlJSuulGB7
26
- rs3ixWpkwRW8Knz2A5zufM3uPypwDYbEUbTdhzqY9hCzCz4moHu2E5f5bz7zrp+g
27
- kpFjMoo851LRGr5vEQMZ/U+Paq8ROLzAiOa72mNxIFzvnGcSDyBVixdewi7HoZWD
28
- ccrr0sGoLnfK6DappOwH1I5uPvQohOATNmmU0MSSWOeiggLlEWmUYE7CvzoMc8R6
29
- DlumKi5y9wE+XnxtyLbe6GlT3AkVGnhwPdwq2QBFLEWkTVogdCYomBCKfjY=
30
- -----END CERTIFICATE-----
31
- date: 2019-01-21 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2021-01-04 00:00:00.000000000 Z
32
12
  dependencies:
33
13
  - !ruby/object:Gem::Dependency
34
14
  name: sidekiq
@@ -78,14 +58,14 @@ dependencies:
78
58
  requirements:
79
59
  - - "~>"
80
60
  - !ruby/object:Gem::Version
81
- version: '10.0'
61
+ version: '12.3'
82
62
  type: :development
83
63
  prerelease: false
84
64
  version_requirements: !ruby/object:Gem::Requirement
85
65
  requirements:
86
66
  - - "~>"
87
67
  - !ruby/object:Gem::Version
88
- version: '10.0'
68
+ version: '12.3'
89
69
  - !ruby/object:Gem::Dependency
90
70
  name: rspec
91
71
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
126
  - !ruby/object:Gem::Version
147
127
  version: '0'
148
128
  requirements: []
149
- rubygems_version: 3.0.2
129
+ rubygems_version: 3.1.4
150
130
  signing_key:
151
131
  specification_version: 4
152
132
  summary: Publish Sidekiq metrics to AWS CloudWatch
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file