sidekiq-cloudwatchmetrics 2.0.0 → 2.1.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: c546a1ec9301787c3ea92c0d9d36cd9ac3076642e7d2b5493813e1705f2068e7
4
- data.tar.gz: 46ac0dc38fb88bc38788f33b5589e9bc5481eb4e1398bc680868d26159ee0f91
3
+ metadata.gz: 7c0bc1eac7c14e56b549ea393000fa88306a086af44fcb76636a006af98113d4
4
+ data.tar.gz: b94ff7bb5d16efd1930b966d61e3b2c939e645970d4b0b98a142529086adad2c
5
5
  SHA512:
6
- metadata.gz: 58b79e36af043d0342dfa1b29e9de3c024ca861dd4eab597442ade986dbcb3b4337badff8a321e2a63937c80fe89c8cf19f528a624942c43a788d261170e8d41
7
- data.tar.gz: 2c308a7266415a8c11dd6425169ecea8b27644e589a9923f231f6cfff11830aa827c8ba24af45e011227c84c1adcfb133c5316ac61b1a1e850f46a8911f465b6
6
+ metadata.gz: 832f4ab05b80ec74800986376b5c53f59b6ef909d1fc3fc634ec25d7818b962058be3a0e4f4be31c95c36fafd65c27f4ed59c89f906901abe143f02fd369adbf
7
+ data.tar.gz: 26a7acfaea5ed47cdd848b64d119a06004efdc4aa9f0915cc8f11b817d854bdedf9bc970507097a365fc262d41647a685da765a45d3b0f126a9580afda6a4fd1
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -40,6 +40,13 @@ Sidekiq::CloudWatchMetrics.enable!(client: AWS::CloudWatch::Client.new)
40
40
 
41
41
  [cwclient]: https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/CloudWatch/Client.html
42
42
 
43
+ The default namespace for metrics is "Sidekiq". You can configure this with the `namespace` option:
44
+
45
+ ```ruby
46
+ Sidekiq::CloudWatchMetrics.enable!(client: AWS::CloudWatch::Client.new, namespace: "Sidekiq-Staging")
47
+ ```
48
+
49
+
43
50
  ## Development
44
51
 
45
52
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -38,8 +38,10 @@ 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, namespace: "Sidekiq", additional_dimensions: {})
42
42
  @client = client
43
+ @namespace = namespace
44
+ @additional_dimensions = additional_dimensions.map { |k, v| {name: k.to_s, value: v.to_s} }
43
45
  end
44
46
 
45
47
  def start
@@ -176,10 +178,16 @@ module Sidekiq::CloudWatchMetrics
176
178
  }
177
179
  end
178
180
 
181
+ unless @additional_dimensions.empty?
182
+ metrics = metrics.each do |metric|
183
+ metric[:dimensions] = (metric[:dimensions] || []) + @additional_dimensions
184
+ end
185
+ end
186
+
179
187
  # We can only put 20 metrics at a time
180
188
  metrics.each_slice(20) do |some_metrics|
181
189
  @client.put_metric_data(
182
- namespace: "Sidekiq",
190
+ namespace: @namespace,
183
191
  metric_data: some_metrics,
184
192
  )
185
193
  end
@@ -209,6 +217,9 @@ module Sidekiq::CloudWatchMetrics
209
217
  @stop = true
210
218
  @thread.wakeup
211
219
  @thread.join
220
+ rescue ThreadError
221
+ # Don't raise if thread is already dead.
222
+ nil
212
223
  end
213
224
  end
214
225
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-cloudwatchmetrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Cochran
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDKDCCAhCgAwIBAgIBBzANBgkqhkiG9w0BAQsFADA6MQ0wCwYDVQQDDARzajI2
14
- MRQwEgYKCZImiZPyLGQBGRYE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x3xdoSWpLf+FvXJRbYrqwZIsmME
29
- V8zEtJFhdNOFOdtcTE67qh/aYQe2y/LDnG9ywXHWdSeF4UUjg1WRt8s3OP8=
24
+ m3ZsDWrNC80wDQYJKoZIhvcNAQELBQADggEBAInkmTwBeGEJ7Xu9jjZIuFaE197m
25
+ YfvrzVoE6Q1DlWXpgyhhxbPIKg2acvM/Z18A7kQrF7paYl64Ti84dC64seOFIBNx
26
+ Qj/lxzPHMBoAYqeXYJhnYIXnvGCZ4Fkic5Bhs+VdcDP/uwYp3adqy+4bT/XDFZQg
27
+ tSjrAOTg3wck5aI+Tz90ONQJ83bnCRr1UPQ0T3PbWMjnNsEa9CAxUB845Sg+9yUz
28
+ Tvf+pbX8JT9rawFDogxPhL7eRAbjg4MH9amp5l8HTVCAsW8vqv7wM4rtMNAaXmik
29
+ LJghfDEf70fTtbs4Zv57pPhn1b7wBNf8fh+TZOlYAA6dFtQXoCwfE6bWgQU=
30
30
  -----END CERTIFICATE-----
31
- date: 2019-10-24 00:00:00.000000000 Z
31
+ date: 2021-06-03 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: sidekiq
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '5.0'
40
+ - - "<"
38
41
  - !ruby/object:Gem::Version
39
- version: '6.0'
42
+ version: '7.0'
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
- - - "~>"
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '5.0'
50
+ - - "<"
45
51
  - !ruby/object:Gem::Version
46
- version: '6.0'
52
+ version: '7.0'
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: aws-sdk-cloudwatch
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -64,28 +70,28 @@ dependencies:
64
70
  requirements:
65
71
  - - "~>"
66
72
  - !ruby/object:Gem::Version
67
- version: '1.16'
73
+ version: '2.2'
68
74
  type: :development
69
75
  prerelease: false
70
76
  version_requirements: !ruby/object:Gem::Requirement
71
77
  requirements:
72
78
  - - "~>"
73
79
  - !ruby/object:Gem::Version
74
- version: '1.16'
80
+ version: '2.2'
75
81
  - !ruby/object:Gem::Dependency
76
82
  name: rake
77
83
  requirement: !ruby/object:Gem::Requirement
78
84
  requirements:
79
85
  - - "~>"
80
86
  - !ruby/object:Gem::Version
81
- version: '10.0'
87
+ version: '12.3'
82
88
  type: :development
83
89
  prerelease: false
84
90
  version_requirements: !ruby/object:Gem::Requirement
85
91
  requirements:
86
92
  - - "~>"
87
93
  - !ruby/object:Gem::Version
88
- version: '10.0'
94
+ version: '12.3'
89
95
  - !ruby/object:Gem::Dependency
90
96
  name: rspec
91
97
  requirement: !ruby/object:Gem::Requirement
@@ -114,6 +120,20 @@ dependencies:
114
120
  - - "~>"
115
121
  - !ruby/object:Gem::Version
116
122
  version: '0.9'
123
+ - !ruby/object:Gem::Dependency
124
+ name: rexml
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '3.2'
130
+ type: :development
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: '3.2'
117
137
  description: |
118
138
  Runs a thread inside your Sidekiq processes to report metrics to CloudWatch
119
139
  useful for autoscaling and keeping an eye on your queues.
@@ -137,7 +157,7 @@ require_paths:
137
157
  - lib
138
158
  required_ruby_version: !ruby/object:Gem::Requirement
139
159
  requirements:
140
- - - "~>"
160
+ - - ">="
141
161
  - !ruby/object:Gem::Version
142
162
  version: '2.4'
143
163
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -146,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
166
  - !ruby/object:Gem::Version
147
167
  version: '0'
148
168
  requirements: []
149
- rubygems_version: 3.0.4
169
+ rubygems_version: 3.1.4
150
170
  signing_key:
151
171
  specification_version: 4
152
172
  summary: Publish Sidekiq metrics to AWS CloudWatch
metadata.gz.sig CHANGED
Binary file