sidekiq-prometheus-exporter 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: f87acb03bfd483d05068f5f2a257d5975fd26412
4
- data.tar.gz: 75dd769451f7f4986d091733af5b3bec451105f2
3
+ metadata.gz: d8934958c55fc915594c3166725c7c2f82426e1f
4
+ data.tar.gz: 1635e5c78c3976bd31dda6c51172ca32278cce41
5
5
  SHA512:
6
- metadata.gz: 3c6252607f56c4beec9d586ad646db85767707bbaa2a408b6698add82ce0ad951511877c8b89260f182761d9865a4c2946ea2cbd576ad6e9a0a55c9dbf62be14
7
- data.tar.gz: e4e3c7dbed335a4159687621d0eeebcb0f3bf1e204f278b90a7bbb51864133bfb3d47fe64badd30db2b6cb47be30ac446b14b78ffe8fbfb885ab49dbdccf04b2
6
+ metadata.gz: 62f6cb30144fbe784b9fc42127820e8a939637099874c564a857212f4388804c248e44447fa8f757aa5171dbe719e942902b0fb6bd4b06702c4c55e74abbc722
7
+ data.tar.gz: 8050c3dc8053df40c7428b9d7bf44fa25829934ddc83620e64335658c4ad30fb0292ba2e22490c94ce0e3bee807d7c9a29da5f8014ebbd50e74bbf4c5874049e
data/.codeclimate.yml ADDED
@@ -0,0 +1,15 @@
1
+ version: "2"
2
+ plugins:
3
+ duplication:
4
+ enabled: true
5
+ config:
6
+ languages:
7
+ ruby:
8
+ mass_threshold: 30
9
+ exclude_paths:
10
+ - spec/
11
+ rubocop:
12
+ enabled: true
13
+ channel: rubocop-0-58
14
+ exclude_paths:
15
+ - tmp/
data/.rubocop.yml ADDED
@@ -0,0 +1,385 @@
1
+ ---
2
+ require: rubocop-rspec
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 2.2
6
+
7
+ Style/Alias:
8
+ EnforcedStyle: prefer_alias_method
9
+
10
+ Style/AndOr:
11
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
12
+ # or completely (always).
13
+ EnforcedStyle: conditionals
14
+
15
+ # Use ` or %x around command literals.
16
+ Style/CommandLiteral:
17
+ EnforcedStyle: mixed
18
+ # backticks: Always use backticks.
19
+ # percent_x: Always use %x.
20
+ # mixed: Use backticks on single-line commands, and %x on multi-line commands.
21
+ SupportedStyles:
22
+ - backticks
23
+ - percent_x
24
+ - mixed
25
+ # If false, the cop will always recommend using %x if one or more backticks
26
+ # are found in the command string.
27
+ AllowInnerBackticks: false
28
+
29
+ Style/Documentation:
30
+ Enabled: false
31
+
32
+ Style/FrozenStringLiteralComment:
33
+ EnforcedStyle: when_needed
34
+ SupportedStyles:
35
+ # `when_needed` will add the frozen string literal comment to files
36
+ # only when the `TargetRubyVersion` is set to 2.3+.
37
+ - when_needed
38
+ # `always` will always add the frozen string literal comment to a file
39
+ # regardless of the Ruby version or if `freeze` or `<<` are called on a
40
+ # string literal. If you run code against multiple versions of Ruby, it is
41
+ # possible that this will create errors in Ruby 2.3.0+.
42
+ - always
43
+ Exclude:
44
+ - "Gemfile"
45
+ - "Rakefile"
46
+ - "bin/*"
47
+ - "spec/spec_helper.rb"
48
+ - "spec/**/*_spec.rb"
49
+ - "**/*.gemspec"
50
+ - "**/*.rake"
51
+
52
+ # Enable when it will respect line length rules
53
+ Style/IfUnlessModifier:
54
+ Enabled: false
55
+
56
+ Style/Lambda:
57
+ EnforcedStyle: literal
58
+ SupportedStyles:
59
+ - line_count_dependent
60
+ - lambda
61
+ - literal
62
+
63
+ Style/Next:
64
+ # With `always` all conditions at the end of an iteration needs to be
65
+ # replaced by next - with `skip_modifier_ifs` the modifier if like this one
66
+ # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
67
+ EnforcedStyle: skip_modifier_ifs
68
+ # `MinBodyLength` defines the number of lines of the a body of an if / unless
69
+ # needs to have to trigger this cop
70
+ MinBodyLength: 3
71
+ SupportedStyles:
72
+ - skip_modifier_ifs
73
+ - always
74
+
75
+ Style/NonNilCheck:
76
+ # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
77
+ # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
78
+ # **usually** OK, but might change behavior.
79
+ #
80
+ # With `IncludeSemanticChanges` set to `false`, this cop does not report
81
+ # offenses for `!x.nil?` and does no changes that might change behavior.
82
+ IncludeSemanticChanges: false
83
+
84
+ Style/NumericPredicate:
85
+ EnforcedStyle: predicate
86
+ SupportedStyles:
87
+ - predicate
88
+ - comparison
89
+ # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
90
+ # false positives.
91
+ Exclude:
92
+ - 'spec/**/*'
93
+
94
+ Style/MethodCalledOnDoEndBlock:
95
+ Description: 'Avoid chaining a method call on a do...end block.'
96
+ StyleGuide: '#single-line-blocks'
97
+ Enabled: true
98
+
99
+ Style/PercentLiteralDelimiters:
100
+ PreferredDelimiters:
101
+ '%': ()
102
+ '%i': ()
103
+ '%I': ()
104
+ '%q': ()
105
+ '%Q': ()
106
+ '%r': '{}'
107
+ '%s': ()
108
+ '%w': ()
109
+ '%W': ()
110
+ '%x': '{}'
111
+
112
+ Style/SpecialGlobalVars:
113
+ EnforcedStyle: use_english_names
114
+ SupportedStyles:
115
+ - use_perl_names
116
+ - use_english_names
117
+
118
+ Style/StabbyLambdaParentheses:
119
+ EnforcedStyle: require_parentheses
120
+ SupportedStyles:
121
+ - require_parentheses
122
+ - require_no_parentheses
123
+
124
+ Style/StringLiterals:
125
+ EnforcedStyle: single_quotes
126
+ SupportedStyles:
127
+ - single_quotes
128
+ - double_quotes
129
+ # If true, strings which span multiple lines using \ for continuation must
130
+ # use the same type of quotes on each line.
131
+ ConsistentQuotesInMultiline: false
132
+
133
+ Style/StringLiteralsInInterpolation:
134
+ EnforcedStyle: single_quotes
135
+ SupportedStyles:
136
+ - single_quotes
137
+ - double_quotes
138
+
139
+ Style/StringMethods:
140
+ # Mapping from undesired method to desired_method
141
+ # e.g. to use `to_sym` over `intern`:
142
+ #
143
+ # StringMethods:
144
+ # PreferredMethods:
145
+ # intern: to_sym
146
+ PreferredMethods:
147
+ intern: to_sym
148
+
149
+ Style/TernaryParentheses:
150
+ EnforcedStyle: require_parentheses_when_complex
151
+ SupportedStyles:
152
+ - require_parentheses
153
+ - require_no_parentheses
154
+ - require_parentheses_when_complex
155
+ AllowSafeAssignment: true
156
+
157
+ #################### Naming ####################################
158
+
159
+ Naming/AccessorMethodName:
160
+ Description: Check the naming of accessor methods for get_/set_.
161
+ StyleGuide: '#accessor_mutator_method_names'
162
+
163
+ # https://rubocop.readthedocs.io/en/latest/cops_naming/#naminguncommunicativemethodparamname
164
+ Naming/UncommunicativeMethodParamName:
165
+ AllowedNames:
166
+ - _
167
+ - io
168
+ - id
169
+ - to
170
+ - by
171
+ - on
172
+ - in
173
+ - at
174
+
175
+ #################### Layout ####################################
176
+
177
+ Layout/AlignParameters:
178
+ # Alignment of parameters in multi-line method calls.
179
+ #
180
+ # The `with_first_parameter` style aligns the following lines along the same
181
+ # column as the first parameter.
182
+ #
183
+ # method_call(a,
184
+ # b)
185
+ #
186
+ # The `with_fixed_indentation` style aligns the following lines with one
187
+ # level of indentation relative to the start of the line with the method call.
188
+ #
189
+ # method_call(a,
190
+ # b)
191
+ EnforcedStyle: with_fixed_indentation
192
+ SupportedStyles:
193
+ - with_first_parameter
194
+ - with_fixed_indentation
195
+
196
+ # Checks the indentation of the first element in an array literal.
197
+ Layout/IndentArray:
198
+ # The value `special_inside_parentheses` means that array literals with
199
+ # brackets that have their opening bracket on the same line as a surrounding
200
+ # opening round parenthesis, shall have their first element indented relative
201
+ # to the first position inside the parenthesis.
202
+ #
203
+ # The value `consistent` means that the indentation of the first element shall
204
+ # always be relative to the first position of the line where the opening
205
+ # bracket is.
206
+ #
207
+ # The value `align_brackets` means that the indentation of the first element
208
+ # shall always be relative to the position of the opening bracket.
209
+ EnforcedStyle: consistent
210
+ SupportedStyles:
211
+ - special_inside_parentheses
212
+ - consistent
213
+ - align_brackets
214
+ # By default, the indentation width from Style/IndentationWidth is used
215
+ # But it can be overridden by setting this parameter
216
+ IndentationWidth: ~
217
+
218
+ # Checks the indentation of the first key in a hash literal.
219
+ Layout/IndentHash:
220
+ # The value `special_inside_parentheses` means that hash literals with braces
221
+ # that have their opening brace on the same line as a surrounding opening
222
+ # round parenthesis, shall have their first key indented relative to the
223
+ # first position inside the parenthesis.
224
+ #
225
+ # The value `consistent` means that the indentation of the first key shall
226
+ # always be relative to the first position of the line where the opening
227
+ # brace is.
228
+ #
229
+ # The value `align_braces` means that the indentation of the first key shall
230
+ # always be relative to the position of the opening brace.
231
+ EnforcedStyle: consistent
232
+ SupportedStyles:
233
+ - special_inside_parentheses
234
+ - consistent
235
+ - align_braces
236
+ # By default, the indentation width from Style/IndentationWidth is used
237
+ # But it can be overridden by setting this parameter
238
+ IndentationWidth: ~
239
+
240
+ Layout/SpaceBeforeFirstArg:
241
+ # When true, allows most uses of extra spacing if the intent is to align
242
+ # things with the previous or next line, not counting empty lines or comment
243
+ # lines.
244
+ AllowForAlignment: false
245
+
246
+ Layout/SpaceAroundBlockParameters:
247
+ EnforcedStyleInsidePipes: no_space
248
+
249
+ Layout/SpaceInsideHashLiteralBraces:
250
+ EnforcedStyle: no_space
251
+ EnforcedStyleForEmptyBraces: no_space
252
+ SupportedStyles:
253
+ - space
254
+ - no_space
255
+ # 'compact' normally requires a space inside hash braces, with the exception
256
+ # that successive left braces or right braces are collapsed together
257
+ - compact
258
+
259
+ Layout/MultilineMethodCallIndentation:
260
+ EnforcedStyle: indented
261
+ SupportedStyles:
262
+ - aligned
263
+ - indented
264
+ - indented_relative_to_receiver
265
+ # By default, the indentation width from Layout/IndentationWidth is used
266
+ # But it can be overridden by setting this parameter
267
+ IndentationWidth: ~
268
+
269
+ Layout/MultilineOperationIndentation:
270
+ EnforcedStyle: indented
271
+ SupportedStyles:
272
+ - aligned
273
+ - indented
274
+ # By default, the indentation width from Style/IndentationWidth is used
275
+ # But it can be overridden by setting this parameter
276
+ IndentationWidth: ~
277
+
278
+ ##################### Metrics ##################################
279
+
280
+ Metrics/LineLength:
281
+ # Default: 80
282
+ Max: 120
283
+
284
+ Metrics/MethodLength:
285
+ # Default: 10
286
+ Max: 15
287
+
288
+ Metrics/BlockLength:
289
+ Exclude:
290
+ - 'Rakefile'
291
+ - '**/*.gemspec'
292
+ - '**/*.rake'
293
+ - 'spec/**/*.rb'
294
+
295
+ ##################### Lint ##################################
296
+
297
+ # https://rubocop.readthedocs.io/en/latest/cops_lint/#lintambiguousblockassociation
298
+ Lint/AmbiguousBlockAssociation:
299
+ Enabled: false
300
+
301
+ Lint/InheritException:
302
+ # The default base class in favour of `Exception`.
303
+ EnforcedStyle: standard_error
304
+ SupportedStyles:
305
+ - runtime_error
306
+ - standard_error
307
+
308
+ ##################### Rails ##################################
309
+
310
+ # NOT IMPLEMENTED YET
311
+ # Rails/EnumUniqueness:
312
+ # Include:
313
+ # - app/models/**/*.rb
314
+
315
+ ##################### RSpec ##################################
316
+
317
+ # Disabled because we want to adjust it and allow to use it
318
+ RSpec/AnyInstance:
319
+ Enabled: false
320
+
321
+ # Allow only `when` prefix
322
+ # https://github.com/rubocop-hq/rubocop-rspec/blob/c1fd129a59e650b8af518ae2e62848aa7eb8498e/config/default.yml#L51
323
+ RSpec/ContextWording:
324
+ Prefixes:
325
+ - when
326
+
327
+ Layout/DefEndAlignment:
328
+ # The value `def` means that `end` should be aligned with the def keyword.
329
+ # The value `start_of_line` means that `end` should be aligned with method
330
+ # calls like `private`, `public`, etc, if present in front of the `def`
331
+ # keyword on the same line.
332
+ EnforcedStyleAlignWith: start_of_line
333
+ AutoCorrect: false
334
+
335
+ # Disabled because we want to adjust it and allow to use it
336
+ # and allow just to write a normal description
337
+ RSpec/DescribeMethod:
338
+ Enabled: false
339
+
340
+ # Allow only for inline test cases
341
+ # https://github.com/rubocop-hq/rubocop-rspec/blob/c1fd129a59e650b8af518ae2e62848aa7eb8498e/config/default.yml#L122
342
+ RSpec/ExampleWithoutDescription:
343
+ EnforcedStyle: single_line_only
344
+
345
+ # Disabled because we want to adjust it and allow to use it with
346
+ # better names, not everything is squashed
347
+ # https://github.com/rubocop-hq/rubocop-rspec/blob/c1fd129a59e650b8af518ae2e62848aa7eb8498e/config/default.yml#L169
348
+ RSpec/FilePath:
349
+ Enabled: false
350
+
351
+ # Don't run check because no implicit expectations are allowed
352
+ # https://github.com/rubocop-hq/rubocop-rspec/blob/c1fd129a59e650b8af518ae2e62848aa7eb8498e/config/default.yml#L193
353
+ RSpec/ImplicitExpect:
354
+ Enabled: false
355
+
356
+ # Disabled because we want to adjust it and allow to use it with the
357
+ # option to check that it's the latest item in the context `let`s
358
+ # https://github.com/rubocop-hq/rubocop-rspec/blob/c1fd129a59e650b8af518ae2e62848aa7eb8498e/config/default.yml#L227
359
+ RSpec/LeadingSubject:
360
+ Enabled: false
361
+
362
+ # https://github.com/rubocop-hq/rubocop-rspec/blob/c1fd129a59e650b8af518ae2e62848aa7eb8498e/config/default.yml#L247
363
+ RSpec/MessageExpectation:
364
+ Enabled: true
365
+
366
+ # https://github.com/rubocop-hq/rubocop-rspec/blob/c1fd129a59e650b8af518ae2e62848aa7eb8498e/config/default.yml#L275
367
+ RSpec/MultipleExpectations:
368
+ Enabled: true
369
+ # Default: 1
370
+ Max: 5
371
+
372
+ # https://github.com/rubocop-hq/rubocop-rspec/blob/c1fd129a59e650b8af518ae2e62848aa7eb8498e/config/default.yml#L292
373
+ RSpec/NestedGroups:
374
+ Description: Checks for nested example groups.
375
+ Enabled: true
376
+ # Default: 3
377
+ Max: 4
378
+
379
+ # https://github.com/rubocop-hq/rubocop-rspec/blob/c1fd129a59e650b8af518ae2e62848aa7eb8498e/config/default.yml#L366
380
+ RSpec/ScatteredSetup:
381
+ Enabled: true
382
+
383
+ # Enable in future
384
+ FactoryBot/AttributeDefinedStatically:
385
+ Enabled: false
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in sidekiq-prometheus-exporter.gemspec
6
6
  gemspec
data/README.md CHANGED
@@ -45,7 +45,7 @@ $ bundle
45
45
  Or install it yourself as:
46
46
 
47
47
  ```bash
48
- $ gem install test
48
+ $ gem install sidekiq-prometheus-exporter -v '~> 0.1'
49
49
  ```
50
50
 
51
51
  # Rack application
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "sidekiq/prometheus/exporter"
3
+ require 'bundler/setup'
4
+ require 'sidekiq/prometheus/exporter'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "sidekiq/prometheus/exporter"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
@@ -15,7 +15,7 @@ class BrokenWorker
15
15
  retry: 5
16
16
 
17
17
  def perform
18
- raise RuntimeError, 'Ooooooops ...'
18
+ raise 'Ooooooops ...'
19
19
  end
20
20
  end
21
21
 
@@ -1,11 +1,11 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
- gem "slim"
6
- gem "redis", ">= 3.3.5"
7
- gem "sinatra"
8
- gem "concurrent-ruby"
9
- gem "sidekiq", "= 3.3.1"
5
+ gem 'concurrent-ruby'
6
+ gem 'redis', '>= 3.3.5'
7
+ gem 'sidekiq', '= 3.3.1'
8
+ gem 'sinatra'
9
+ gem 'slim'
10
10
 
11
- gemspec path: "../"
11
+ gemspec path: '../'
@@ -38,13 +38,14 @@ GEM
38
38
  diff-lcs (1.3)
39
39
  docile (1.1.5)
40
40
  hitimes (1.2.6)
41
+ jaro_winkler (1.5.1)
41
42
  json (2.1.0)
42
43
  method_source (0.9.0)
43
44
  mustermann (1.0.1)
44
45
  parallel (1.12.1)
45
- parser (2.4.0.2)
46
- ast (~> 2.3)
47
- powerpack (0.1.1)
46
+ parser (2.5.1.2)
47
+ ast (~> 2.4.0)
48
+ powerpack (0.1.2)
48
49
  pry (0.11.3)
49
50
  coderay (~> 1.1.0)
50
51
  method_source (~> 0.9.0)
@@ -74,14 +75,17 @@ GEM
74
75
  diff-lcs (>= 1.2.0, < 2.0)
75
76
  rspec-support (~> 3.7.0)
76
77
  rspec-support (3.7.1)
77
- rubocop (0.52.1)
78
+ rubocop (0.58.2)
79
+ jaro_winkler (~> 1.5.1)
78
80
  parallel (~> 1.10)
79
- parser (>= 2.4.0.2, < 3.0)
81
+ parser (>= 2.5, != 2.5.1.1)
80
82
  powerpack (~> 0.1)
81
83
  rainbow (>= 2.2.2, < 4.0)
82
84
  ruby-progressbar (~> 1.7)
83
85
  unicode-display_width (~> 1.0, >= 1.0.1)
84
- ruby-progressbar (1.9.0)
86
+ rubocop-rspec (1.28.0)
87
+ rubocop (>= 0.58.0)
88
+ ruby-progressbar (1.10.0)
85
89
  sidekiq (3.3.1)
86
90
  celluloid (>= 0.16.0)
87
91
  connection_pool (>= 2.1.1)
@@ -106,7 +110,7 @@ GEM
106
110
  tilt (2.0.8)
107
111
  timers (4.1.2)
108
112
  hitimes
109
- unicode-display_width (1.3.0)
113
+ unicode-display_width (1.4.0)
110
114
 
111
115
  PLATFORMS
112
116
  ruby
@@ -121,11 +125,12 @@ DEPENDENCIES
121
125
  rake (~> 10.0)
122
126
  redis (>= 3.3.5)
123
127
  rspec (~> 3.0)
124
- rubocop (~> 0.52)
128
+ rubocop (~> 0.58)
129
+ rubocop-rspec (~> 1.28.0)
125
130
  sidekiq (= 3.3.1)
126
131
  sidekiq-prometheus-exporter!
127
132
  sinatra
128
133
  slim
129
134
 
130
135
  BUNDLED WITH
131
- 1.16.1
136
+ 1.16.2
@@ -1,11 +1,11 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
- gem "slim"
6
- gem "redis", ">= 3.3.5"
7
- gem "sinatra"
8
- gem "concurrent-ruby"
9
- gem "sidekiq", "~> 3.0"
5
+ gem 'concurrent-ruby'
6
+ gem 'redis', '>= 3.3.5'
7
+ gem 'sidekiq', '~> 3.0'
8
+ gem 'sinatra'
9
+ gem 'slim'
10
10
 
11
- gemspec path: "../"
11
+ gemspec path: '../'
@@ -38,13 +38,14 @@ GEM
38
38
  diff-lcs (1.3)
39
39
  docile (1.1.5)
40
40
  hitimes (1.2.6)
41
+ jaro_winkler (1.5.1)
41
42
  json (2.1.0)
42
43
  method_source (0.9.0)
43
44
  mustermann (1.0.1)
44
45
  parallel (1.12.1)
45
- parser (2.4.0.2)
46
- ast (~> 2.3)
47
- powerpack (0.1.1)
46
+ parser (2.5.1.2)
47
+ ast (~> 2.4.0)
48
+ powerpack (0.1.2)
48
49
  pry (0.11.3)
49
50
  coderay (~> 1.1.0)
50
51
  method_source (~> 0.9.0)
@@ -74,14 +75,17 @@ GEM
74
75
  diff-lcs (>= 1.2.0, < 2.0)
75
76
  rspec-support (~> 3.7.0)
76
77
  rspec-support (3.7.1)
77
- rubocop (0.52.1)
78
+ rubocop (0.58.2)
79
+ jaro_winkler (~> 1.5.1)
78
80
  parallel (~> 1.10)
79
- parser (>= 2.4.0.2, < 3.0)
81
+ parser (>= 2.5, != 2.5.1.1)
80
82
  powerpack (~> 0.1)
81
83
  rainbow (>= 2.2.2, < 4.0)
82
84
  ruby-progressbar (~> 1.7)
83
85
  unicode-display_width (~> 1.0, >= 1.0.1)
84
- ruby-progressbar (1.9.0)
86
+ rubocop-rspec (1.28.0)
87
+ rubocop (>= 0.58.0)
88
+ ruby-progressbar (1.10.0)
85
89
  sidekiq (3.3.1)
86
90
  celluloid (>= 0.16.0)
87
91
  connection_pool (>= 2.1.1)
@@ -106,7 +110,7 @@ GEM
106
110
  tilt (2.0.8)
107
111
  timers (4.1.2)
108
112
  hitimes
109
- unicode-display_width (1.3.0)
113
+ unicode-display_width (1.4.0)
110
114
 
111
115
  PLATFORMS
112
116
  ruby
@@ -121,11 +125,12 @@ DEPENDENCIES
121
125
  rake (~> 10.0)
122
126
  redis (>= 3.3.5)
123
127
  rspec (~> 3.0)
124
- rubocop (~> 0.52)
128
+ rubocop (~> 0.58)
129
+ rubocop-rspec (~> 1.28.0)
125
130
  sidekiq (~> 3.0)
126
131
  sidekiq-prometheus-exporter!
127
132
  sinatra
128
133
  slim
129
134
 
130
135
  BUNDLED WITH
131
- 1.16.1
136
+ 1.16.2
@@ -1,8 +1,8 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
- gem "redis", ">= 3.3.5"
6
- gem "sidekiq", "~> 4.0"
5
+ gem 'redis', '>= 3.3.5'
6
+ gem 'sidekiq', '~> 4.0'
7
7
 
8
- gemspec path: "../"
8
+ gemspec path: '../'
@@ -20,12 +20,13 @@ GEM
20
20
  connection_pool (2.2.1)
21
21
  diff-lcs (1.3)
22
22
  docile (1.1.5)
23
+ jaro_winkler (1.5.1)
23
24
  json (2.1.0)
24
25
  method_source (0.9.0)
25
26
  parallel (1.12.1)
26
- parser (2.4.0.2)
27
- ast (~> 2.3)
28
- powerpack (0.1.1)
27
+ parser (2.5.1.2)
28
+ ast (~> 2.4.0)
29
+ powerpack (0.1.2)
29
30
  pry (0.11.3)
30
31
  coderay (~> 1.1.0)
31
32
  method_source (~> 0.9.0)
@@ -53,14 +54,17 @@ GEM
53
54
  diff-lcs (>= 1.2.0, < 2.0)
54
55
  rspec-support (~> 3.7.0)
55
56
  rspec-support (3.7.1)
56
- rubocop (0.52.1)
57
+ rubocop (0.58.2)
58
+ jaro_winkler (~> 1.5.1)
57
59
  parallel (~> 1.10)
58
- parser (>= 2.4.0.2, < 3.0)
60
+ parser (>= 2.5, != 2.5.1.1)
59
61
  powerpack (~> 0.1)
60
62
  rainbow (>= 2.2.2, < 4.0)
61
63
  ruby-progressbar (~> 1.7)
62
64
  unicode-display_width (~> 1.0, >= 1.0.1)
63
- ruby-progressbar (1.9.0)
65
+ rubocop-rspec (1.28.0)
66
+ rubocop (>= 0.58.0)
67
+ ruby-progressbar (1.10.0)
64
68
  sidekiq (4.2.10)
65
69
  concurrent-ruby (~> 1.0)
66
70
  connection_pool (~> 2.2, >= 2.2.0)
@@ -72,7 +76,7 @@ GEM
72
76
  simplecov-html (~> 0.10.0)
73
77
  simplecov-html (0.10.2)
74
78
  thor (0.20.0)
75
- unicode-display_width (1.3.0)
79
+ unicode-display_width (1.4.0)
76
80
 
77
81
  PLATFORMS
78
82
  ruby
@@ -86,9 +90,10 @@ DEPENDENCIES
86
90
  rake (~> 10.0)
87
91
  redis (>= 3.3.5)
88
92
  rspec (~> 3.0)
89
- rubocop (~> 0.52)
93
+ rubocop (~> 0.58)
94
+ rubocop-rspec (~> 1.28.0)
90
95
  sidekiq (~> 4.0)
91
96
  sidekiq-prometheus-exporter!
92
97
 
93
98
  BUNDLED WITH
94
- 1.16.1
99
+ 1.16.2
@@ -1,8 +1,8 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
- gem "redis", ">= 3.3.5"
6
- gem "sidekiq", "~> 5.0"
5
+ gem 'redis', '>= 3.3.5'
6
+ gem 'sidekiq', '~> 5.0'
7
7
 
8
- gemspec path: "../"
8
+ gemspec path: '../'
@@ -20,12 +20,13 @@ GEM
20
20
  connection_pool (2.2.1)
21
21
  diff-lcs (1.3)
22
22
  docile (1.1.5)
23
+ jaro_winkler (1.5.1)
23
24
  json (2.1.0)
24
25
  method_source (0.9.0)
25
26
  parallel (1.12.1)
26
- parser (2.4.0.2)
27
- ast (~> 2.3)
28
- powerpack (0.1.1)
27
+ parser (2.5.1.2)
28
+ ast (~> 2.4.0)
29
+ powerpack (0.1.2)
29
30
  pry (0.11.3)
30
31
  coderay (~> 1.1.0)
31
32
  method_source (~> 0.9.0)
@@ -53,14 +54,17 @@ GEM
53
54
  diff-lcs (>= 1.2.0, < 2.0)
54
55
  rspec-support (~> 3.7.0)
55
56
  rspec-support (3.7.1)
56
- rubocop (0.52.1)
57
+ rubocop (0.58.2)
58
+ jaro_winkler (~> 1.5.1)
57
59
  parallel (~> 1.10)
58
- parser (>= 2.4.0.2, < 3.0)
60
+ parser (>= 2.5, != 2.5.1.1)
59
61
  powerpack (~> 0.1)
60
62
  rainbow (>= 2.2.2, < 4.0)
61
63
  ruby-progressbar (~> 1.7)
62
64
  unicode-display_width (~> 1.0, >= 1.0.1)
63
- ruby-progressbar (1.9.0)
65
+ rubocop-rspec (1.28.0)
66
+ rubocop (>= 0.58.0)
67
+ ruby-progressbar (1.10.0)
64
68
  sidekiq (5.1.1)
65
69
  concurrent-ruby (~> 1.0)
66
70
  connection_pool (~> 2.2, >= 2.2.0)
@@ -72,7 +76,7 @@ GEM
72
76
  simplecov-html (~> 0.10.0)
73
77
  simplecov-html (0.10.2)
74
78
  thor (0.20.0)
75
- unicode-display_width (1.3.0)
79
+ unicode-display_width (1.4.0)
76
80
 
77
81
  PLATFORMS
78
82
  ruby
@@ -86,9 +90,10 @@ DEPENDENCIES
86
90
  rake (~> 10.0)
87
91
  redis (>= 3.3.5)
88
92
  rspec (~> 3.0)
89
- rubocop (~> 0.52)
93
+ rubocop (~> 0.58)
94
+ rubocop-rspec (~> 1.28.0)
90
95
  sidekiq (~> 5.0)
91
96
  sidekiq-prometheus-exporter!
92
97
 
93
98
  BUNDLED WITH
94
- 1.16.1
99
+ 1.16.2
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'erb'
3
4
  require 'sidekiq/prometheus/exporter/version'
4
- require 'sidekiq/api'
5
+ require 'sidekiq/prometheus/exporter/metrics'
5
6
 
6
7
  module Sidekiq
7
8
  module Prometheus
@@ -14,40 +15,13 @@ module Sidekiq
14
15
  'Content-Type' => 'text/plain; version=0.0.4',
15
16
  'Cache-Control' => 'no-cache'
16
17
  }.freeze
17
- LATENCY_TEMPLATE = 'sidekiq_queue_latency_seconds{name="%<name>s"} %<latency>.3f'.freeze
18
- METRICS_TEMPLATE = <<-TEXT.gsub(/^[^\r\n][[:space:]]{2,}/, '').freeze
19
- # HELP sidekiq_processed_jobs_total The total number of processed jobs.
20
- # TYPE sidekiq_processed_jobs_total counter
21
- sidekiq_processed_jobs_total %<processed_jobs>d
18
+ TEMPLATE = ERB.new(File.read(File.expand_path('exporter/templates/metrics.erb', __dir__)))
22
19
 
23
- # HELP sidekiq_failed_jobs_total The total number of failed jobs.
24
- # TYPE sidekiq_failed_jobs_total counter
25
- sidekiq_failed_jobs_total %<failed_jobs>d
26
-
27
- # HELP sidekiq_busy_workers The number of workers performing the job.
28
- # TYPE sidekiq_busy_workers gauge
29
- sidekiq_busy_workers %<busy_workers>d
30
-
31
- # HELP sidekiq_enqueued_jobs The number of enqueued jobs.
32
- # TYPE sidekiq_enqueued_jobs gauge
33
- sidekiq_enqueued_jobs %<enqueued_jobs>d
34
-
35
- # HELP sidekiq_scheduled_jobs The number of jobs scheduled for a future execution.
36
- # TYPE sidekiq_scheduled_jobs gauge
37
- sidekiq_scheduled_jobs %<scheduled_jobs>d
38
-
39
- # HELP sidekiq_retry_jobs The number of jobs scheduled for the next try.
40
- # TYPE sidekiq_retry_jobs gauge
41
- sidekiq_retry_jobs %<retry_jobs>d
42
-
43
- # HELP sidekiq_dead_jobs The number of jobs being dead.
44
- # TYPE sidekiq_dead_jobs gauge
45
- sidekiq_dead_jobs %<dead_jobs>d
46
-
47
- # HELP sidekiq_queue_latency_seconds The amount of seconds between oldest job being pushed to the queue and current time.
48
- # TYPE sidekiq_queue_latency_seconds gauge
49
- %<queues_latency>s
50
- TEXT
20
+ def self.registered(app)
21
+ app.get('/metrics') do
22
+ Sidekiq::Prometheus::Exporter.call(REQUEST_METHOD => HTTP_GET)
23
+ end
24
+ end
51
25
 
52
26
  def self.to_app
53
27
  Rack::Builder.app do
@@ -60,30 +34,9 @@ module Sidekiq
60
34
  def self.call(env)
61
35
  return [404, HEADERS, [NOT_FOUND_TEXT]] if env[REQUEST_METHOD] != HTTP_GET
62
36
 
63
- stats = Sidekiq::Stats.new
64
- queues_latency = Sidekiq::Queue.all.map do |queue|
65
- format(LATENCY_TEMPLATE, name: queue.name, latency: queue.latency)
66
- end
67
- body = format(
68
- METRICS_TEMPLATE,
69
- processed_jobs: stats.processed,
70
- scheduled_jobs: stats.scheduled_size,
71
- enqueued_jobs: stats.enqueued,
72
- failed_jobs: stats.failed,
73
- retry_jobs: stats.retry_size,
74
- dead_jobs: stats.dead_size,
75
- busy_workers: stats.workers_size,
76
- queues_latency: queues_latency * "\n"
77
- )
78
-
37
+ body = TEMPLATE.result(Metrics.new.__binding__).chomp!
79
38
  [200, HEADERS, [body]]
80
39
  end
81
-
82
- def self.registered(app)
83
- app.get('/metrics') do
84
- Sidekiq::Prometheus::Exporter.call(REQUEST_METHOD => HTTP_GET)
85
- end
86
- end
87
40
  end
88
41
  end
89
42
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'sidekiq/api'
4
+
5
+ class Metrics
6
+ QueueStats = Struct.new(:name, :size, :latency)
7
+
8
+ def initialize
9
+ @overview_stats = Sidekiq::Stats.new
10
+ @queues_stats = queues_stats
11
+ end
12
+
13
+ private
14
+
15
+ def queues_stats
16
+ Sidekiq::Queue.all.map do |queue|
17
+ QueueStats.new(queue.name, queue.size, queue.latency)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,36 @@
1
+ # HELP sidekiq_processed_jobs_total The total number of processed jobs.
2
+ # TYPE sidekiq_processed_jobs_total counter
3
+ sidekiq_processed_jobs_total <%= format('%d', @overview_stats.processed) %>
4
+
5
+ # HELP sidekiq_failed_jobs_total The total number of failed jobs.
6
+ # TYPE sidekiq_failed_jobs_total counter
7
+ sidekiq_failed_jobs_total <%= format('%d', @overview_stats.failed) %>
8
+
9
+ # HELP sidekiq_busy_workers The number of workers performing the job.
10
+ # TYPE sidekiq_busy_workers gauge
11
+ sidekiq_busy_workers <%= format('%d', @overview_stats.workers_size) %>
12
+
13
+ # HELP sidekiq_enqueued_jobs The number of enqueued jobs.
14
+ # TYPE sidekiq_enqueued_jobs gauge
15
+ sidekiq_enqueued_jobs <%= format('%d', @overview_stats.enqueued) %>
16
+
17
+ # HELP sidekiq_scheduled_jobs The number of jobs scheduled for a future execution.
18
+ # TYPE sidekiq_scheduled_jobs gauge
19
+ sidekiq_scheduled_jobs <%= format('%d', @overview_stats.scheduled_size) %>
20
+
21
+ # HELP sidekiq_retry_jobs The number of jobs scheduled for the next try.
22
+ # TYPE sidekiq_retry_jobs gauge
23
+ sidekiq_retry_jobs <%= format('%d', @overview_stats.retry_size) %>
24
+
25
+ # HELP sidekiq_dead_jobs The number of jobs being dead.
26
+ # TYPE sidekiq_dead_jobs gauge
27
+ sidekiq_dead_jobs <%= format('%d', @overview_stats.dead_size) %>
28
+
29
+ # HELP sidekiq_queue_latency_seconds The amount of seconds between oldest job being pushed to the queue and current time.
30
+ # TYPE sidekiq_queue_latency_seconds gauge
31
+ <% @queues_stats.each do |queue| %>sidekiq_queue_latency_seconds{name="<%= queue.name %>"} <%= format('%.3f', queue.latency) %>
32
+ <% end %>
33
+ # HELP sidekiq_queue_size The amount of jobs pushed to the queue.
34
+ # TYPE sidekiq_queue_size gauge
35
+ <% @queues_stats.each do |queue| %>sidekiq_queue_size{name="<%= queue.name %>"} <%= format('%d', queue.size) %>
36
+ <% end %>
@@ -1,7 +1,7 @@
1
1
  module Sidekiq
2
2
  module Prometheus
3
3
  module Exporter
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'sidekiq/prometheus/exporter/version'
6
6
 
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.name = 'sidekiq-prometheus-exporter'
9
9
  spec.version = Sidekiq::Prometheus::Exporter::VERSION
10
10
  spec.authors = ['Sergey Fedorov']
11
- spec.email = %w[oni.strech@gmail.com]
11
+ spec.email = %w(oni.strech@gmail.com)
12
12
 
13
13
  spec.summary = 'Prometheus exporter for the Sidekiq'
14
14
  spec.description = 'All the basic metrics prepared for Prometheus'
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  end
27
27
  spec.bindir = 'exe'
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |file| File.basename(file) }
29
- spec.require_paths = %w[lib]
29
+ spec.require_paths = %w(lib)
30
30
 
31
31
  spec.add_dependency 'sidekiq', '>= 3.3.1'
32
32
 
@@ -37,5 +37,6 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency 'rack-test', '~> 0.8'
38
38
  spec.add_development_dependency 'rake', '~> 10.0'
39
39
  spec.add_development_dependency 'rspec', '~> 3.0'
40
- spec.add_development_dependency 'rubocop', '~> 0.52'
40
+ spec.add_development_dependency 'rubocop', '~> 0.58'
41
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.28.0'
41
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-prometheus-exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Fedorov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-11 00:00:00.000000000 Z
11
+ date: 2018-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -128,14 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0.52'
131
+ version: '0.58'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0.52'
138
+ version: '0.58'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 1.28.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 1.28.0
139
153
  description: All the basic metrics prepared for Prometheus
140
154
  email:
141
155
  - oni.strech@gmail.com
@@ -143,8 +157,10 @@ executables: []
143
157
  extensions: []
144
158
  extra_rdoc_files: []
145
159
  files:
160
+ - ".codeclimate.yml"
146
161
  - ".gitignore"
147
162
  - ".rspec"
163
+ - ".rubocop.yml"
148
164
  - ".travis.yml"
149
165
  - Appraisals
150
166
  - Gemfile
@@ -171,6 +187,8 @@ files:
171
187
  - gemfiles/sidekiq_5.x.gemfile
172
188
  - gemfiles/sidekiq_5.x.gemfile.lock
173
189
  - lib/sidekiq/prometheus/exporter.rb
190
+ - lib/sidekiq/prometheus/exporter/metrics.rb
191
+ - lib/sidekiq/prometheus/exporter/templates/metrics.erb
174
192
  - lib/sidekiq/prometheus/exporter/version.rb
175
193
  - sidekiq-prometheus-exporter.gemspec
176
194
  homepage: https://github.com/Strech/sidekiq-prometheus-exporter