puma-metrics 1.0.3 → 1.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: 928e9a269150ae5bbdb5ab3932a809f31cbc5a3253d8ecf967d2e6b1ccd631ad
4
- data.tar.gz: 192cf711eb4eb79fa7eefc12828e7efa931994d733fb3d1debc3868f9a094117
3
+ metadata.gz: db435968b3e4ec0d3a113f4114dad7d8d54214fa91d6b46bd2a17def4dc43791
4
+ data.tar.gz: 4c80158b91cf98faeed9945d6a4c16490b62dbfe4d5be9230874a6602997f596
5
5
  SHA512:
6
- metadata.gz: cae027e4e8ea4c942ad05190fd6ba1d331f02aa095d090f179ea47b1d2353c9a13015776c2fee6b8200d2298b4349efc047577418b0df4cdd86ecb0debd4dcfc
7
- data.tar.gz: c794a3c58ab4fee5c7a33060906ea75c597767adaaeea81da7379fda4dd667f9e3e3bf479c30f284b1bfcf5ae7cf7e1fdc0383d651dbfdb3eb8386d07892ad20
6
+ metadata.gz: 9dc507c3415301df0e3324c7aba236ed96dc3b1d46e3cfeab66a1c646854052909544ab85bb637e5daa4693301d4c92cba47753d07ca2e6b30a6b6960c6ee4f3
7
+ data.tar.gz: c0ccd94196ae42672a1a141690b3f54f70c2a4332853bfcb301d1c146d110ab4977fe5719e2fc5a03e003cf637501a9538bbea6a3d82300afba9d81f5ae37f40
@@ -0,0 +1,10 @@
1
+ # editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ end_of_line = lf
7
+ indent_size = 2
8
+ indent_style = space
9
+ insert_final_newline = true
10
+ trim_trailing_whitespace = true
@@ -0,0 +1,41 @@
1
+ name: steps
2
+ on: [push]
3
+ jobs:
4
+ test:
5
+ name: test on ruby ${{ matrix.ruby }}
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@master
9
+ - uses: actions/setup-ruby@master
10
+ with:
11
+ ruby-version: ${{ matrix.ruby }}
12
+ - run: gem install bundler
13
+ - run: bundle install
14
+ - run: bundle exec rake
15
+ - run: bundle exec overcommit --sign
16
+ - env:
17
+ GIT_AUTHOR_NAME: John Doe
18
+ GIT_AUTHOR_EMAIL: johndoe@example.com
19
+ run: bundle exec overcommit --run
20
+ strategy:
21
+ matrix:
22
+ ruby: ['2.4', '2.5', '2.6']
23
+ deploy:
24
+ if: github.ref == 'refs/heads/master'
25
+ name: to rubygems
26
+ needs: test
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@master
30
+ - uses: actions/setup-ruby@master
31
+ with:
32
+ ruby-version: 2.6
33
+ - env:
34
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
35
+ run: |
36
+ mkdir -p $HOME/.gem
37
+ touch $HOME/.gem/credentials
38
+ chmod 0600 $HOME/.gem/credentials
39
+ printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
40
+ gem build *.gemspec
41
+ gem push *.gem
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.2
2
+ TargetRubyVersion: 2.6
3
3
 
4
4
  Naming/FileName:
5
5
  Exclude:
@@ -10,6 +10,8 @@ Metrics/LineLength:
10
10
 
11
11
  Style/Documentation:
12
12
  Enabled: false
13
+ Style/NumericPredicate:
14
+ Enabled: false
13
15
  Style/MethodMissingSuper:
14
16
  Exclude:
15
17
  - lib/puma/metrics/parser.rb
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0
4
+
5
+ Changes:
6
+ - Upgrade prometheus-client to '~> 0.10'
7
+
8
+ Housekeeping:
9
+ - Set target version to 2.6
10
+ - Added editorconfig
11
+
3
12
  ## 1.0.3
4
13
 
5
14
  Features:
@@ -1,45 +1,39 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puma-metrics (1.0.3)
5
- prometheus-client (~> 0.8)
4
+ puma-metrics (1.1.0)
5
+ prometheus-client (~> 0.10)
6
6
  puma (>= 3.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  ast (2.4.0)
12
- childprocess (0.9.0)
13
- ffi (~> 1.0, >= 1.0.11)
14
- ffi (1.10.0)
12
+ childprocess (3.0.0)
15
13
  iniparse (1.4.4)
16
- jaro_winkler (1.5.2)
17
- minitest (5.11.3)
18
- nio4r (2.5.1)
19
- overcommit (0.47.0)
20
- childprocess (~> 0.6, >= 0.6.3)
14
+ jaro_winkler (1.5.4)
15
+ minitest (5.13.0)
16
+ nio4r (2.5.2)
17
+ overcommit (0.51.0)
18
+ childprocess (>= 0.6.3, < 4)
21
19
  iniparse (~> 1.4)
22
- parallel (1.17.0)
23
- parser (2.6.2.1)
20
+ parallel (1.18.0)
21
+ parser (2.6.5.0)
24
22
  ast (~> 2.4.0)
25
- prometheus-client (0.9.0)
26
- quantile (~> 0.2.1)
27
- psych (3.1.0)
28
- puma (4.1.1)
23
+ prometheus-client (0.10.0)
24
+ puma (4.2.1)
29
25
  nio4r (~> 2.0)
30
- quantile (0.2.1)
31
26
  rainbow (3.0.0)
32
- rake (12.3.2)
33
- rubocop (0.67.2)
27
+ rake (13.0.0)
28
+ rubocop (0.76.0)
34
29
  jaro_winkler (~> 1.5.1)
35
30
  parallel (~> 1.10)
36
- parser (>= 2.5, != 2.5.1.1)
37
- psych (>= 3.1.0)
31
+ parser (>= 2.6)
38
32
  rainbow (>= 2.2.2, < 4.0)
39
33
  ruby-progressbar (~> 1.7)
40
- unicode-display_width (>= 1.4.0, < 1.6)
41
- ruby-progressbar (1.10.0)
42
- unicode-display_width (1.5.0)
34
+ unicode-display_width (>= 1.4.0, < 1.7)
35
+ ruby-progressbar (1.10.1)
36
+ unicode-display_width (1.6.0)
43
37
 
44
38
  PLATFORMS
45
39
  ruby
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rake/testtask'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'prometheus/client/formats/text'
3
5
  require 'puma/metrics/parser'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Puma
2
4
  class DSL
3
5
  def metrics_url(url)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'prometheus/client'
2
4
 
3
5
  module Puma
@@ -19,16 +21,34 @@ module Puma
19
21
  private
20
22
 
21
23
  def register_clustered_metrics
22
- registry.gauge(:puma_booted_workers, 'Number of booted workers').set({}, 1)
23
- registry.gauge(:puma_old_workers, 'Number of old workers').set({}, 0)
24
+ registry.gauge(:puma_booted_workers,
25
+ docstring: 'Number of booted workers')
26
+ .set(1)
27
+ registry.gauge(:puma_old_workers,
28
+ docstring: 'Number of old workers')
29
+ .set(0)
24
30
  end
25
31
 
26
- def register_default_metrics
27
- registry.gauge(:puma_backlog, 'Number of established but unaccepted connections in the backlog', index: 0)
28
- registry.gauge(:puma_running, 'Number of running worker threads', index: 0)
29
- registry.gauge(:puma_pool_capacity, 'Number of allocatable worker threads', index: 0)
30
- registry.gauge(:puma_max_threads, 'Maximum number of worker threads', index: 0)
31
- registry.gauge(:puma_workers, 'Number of configured workers').set({}, 1)
32
+ def register_default_metrics # rubocop:disable Metrics/MethodLength
33
+ registry.gauge(:puma_backlog,
34
+ docstring: 'Number of established but unaccepted connections in the backlog',
35
+ labels: [:index],
36
+ preset_labels: { index: 0 })
37
+ registry.gauge(:puma_running,
38
+ docstring: 'Number of running worker threads',
39
+ labels: [:index],
40
+ preset_labels: { index: 0 })
41
+ registry.gauge(:puma_pool_capacity,
42
+ docstring: 'Number of allocatable worker threads',
43
+ labels: [:index],
44
+ preset_labels: { index: 0 })
45
+ registry.gauge(:puma_max_threads,
46
+ docstring: 'Maximum number of worker threads',
47
+ labels: [:index],
48
+ preset_labels: { index: 0 })
49
+ registry.gauge(:puma_workers,
50
+ docstring: 'Number of configured workers')
51
+ .set(1)
32
52
  end
33
53
 
34
54
  def registry
@@ -38,7 +58,7 @@ module Puma
38
58
  def update_metric(key, value, labels)
39
59
  return if registry.get("puma_#{key}").nil?
40
60
 
41
- registry.get("puma_#{key}").set(labels, value)
61
+ registry.get("puma_#{key}").set(value, labels: labels)
42
62
  end
43
63
  end
44
64
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Puma
2
4
  module Metrics
3
- VERSION = '1.0.3'.freeze
5
+ VERSION = '1.1.0'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puma/metrics/dsl'
2
4
 
3
5
  Puma::Plugin.create do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
 
@@ -15,7 +17,7 @@ Gem::Specification.new do |spec|
15
17
 
16
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
19
 
18
- spec.add_runtime_dependency 'prometheus-client', '~> 0.8'
20
+ spec.add_runtime_dependency 'prometheus-client', '~> 0.10'
19
21
  spec.add_runtime_dependency 'puma', '>= 3.0'
20
22
 
21
23
  spec.add_development_dependency 'bundler'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harm-Jan Blok
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-20 00:00:00.000000000 Z
11
+ date: 2019-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prometheus-client
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.8'
19
+ version: '0.10'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.8'
26
+ version: '0.10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: puma
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -114,9 +114,10 @@ executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
+ - ".editorconfig"
118
+ - ".github/workflows/workflow.yml"
117
119
  - ".overcommit.yml"
118
120
  - ".rubocop.yml"
119
- - ".travis.yml"
120
121
  - CHANGELOG.md
121
122
  - Gemfile
122
123
  - Gemfile.lock
@@ -148,8 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
149
  - !ruby/object:Gem::Version
149
150
  version: '0'
150
151
  requirements: []
151
- rubyforge_project:
152
- rubygems_version: 2.7.7
152
+ rubygems_version: 3.0.3
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: Puma plugin to export puma stats as prometheus metrics
@@ -1,23 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.4
4
- - 2.5
5
- - 2.6
6
- script:
7
- - bundle exec rake
8
- - bundle exec overcommit --sign
9
- - bundle exec overcommit --run
10
- before_install:
11
- - gem update --system
12
- - gem install bundler
13
- branches:
14
- only:
15
- - master
16
- deploy:
17
- provider: rubygems
18
- api_key:
19
- secure: WxQuGnHli0eOu/xYcO8fh8eK5sWxBQHwo5MaGhlZpdCvzELJ943gbfzhaZ7sK9okfLHPiY1uXYYA657KhlnDcrSLg16uI+HmPTi1RoKqQ3VmqQ6YoGhdl2GROlctCfHRO2iRuu7ujz9gf80OBH5ojHOwV+IrNsl911s6/4zhBY8uhFmdVb87zq1ZCPABNxanhlr0x51T6Q+JpdDW8c6FDGqUNtzqxEVMxS81tPhXnpDcUf/H0M8LOIQMyI21WyqUdo2vNqF6hCmRDogpZceJHtECboxgKoGJNEnOZdvAeX48Ysiu4O83Rq/mgBq30JBAgUe4TZPNwDjND+NJQktkzx/+IOJ+52G90VsJiUuBWsyh4IQKK+HqQr2CZyiEBybWU6FHCLifhuXfnOFA/VS2JNme16NiROrgrxoqtezbQ8yO8pgZ0PdtmL6hjBUknmZCyVDCdB1SPQGvo+b4AqkzY/SLuNCuJmOBBE5sMT6xFAiHU94rJViXMeJvF1pSQXIRFSuAQZ7ILOUC/GwqxIUmPk80p893itoFs3ExBPe2tBmzBVWyr+Dvu1SS2of+4JbBNbtOZr+nOT5pl7s4Zk4GG3b9UuozJn5yWi0Aj9iAju8T1r2tMpZ9zQtjrXtZJRi8ri8rQ2lC5ha63XLGGbDQon0bXs656GKKupaUS/BUboI=
20
- gem: puma-metrics
21
- on:
22
- repo: harmjanblok/puma-metrics
23
- rvm: 2.5