yabeda-puma-plugin 0.7.1 → 0.8.0
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 +4 -4
- data/.github/workflows/build-release.yml +9 -5
- data/.github/workflows/test.yml +16 -23
- data/CHANGELOG.md +11 -0
- data/README.md +2 -0
- data/lib/puma/plugin/yabeda.rb +2 -1
- data/lib/puma/plugin/yabeda_prometheus.rb +12 -4
- data/lib/yabeda/puma/plugin/statistics.rb +1 -1
- data/lib/yabeda/puma/plugin/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f149b6a7ae1795abd350b4c37918bb542db554f1f5c6fa6d311815cfa8bc5b5
|
4
|
+
data.tar.gz: 882e94b06e33ba04349f249ca7a6ae08e5c3f542f07609308a7ea8b5767ea6af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5cd81095a3d35cfc0c7c7bf2d479a5718aac70827ebe5f4815ab5bbd64e9ffa33a83df1c73d70beed0d9a1120ddad462fd6c6e380c67baddb16717ab57b43c2
|
7
|
+
data.tar.gz: '006079d4b467fa30b9dd8541c5ea02f3c9557c69011f4a059681674973799fddf0efc07bd2a40b54b477226013416c74ec729600492bd22ed81a2e6c92d4d13e'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
name: Build and release gem
|
1
|
+
name: Build and release gem
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
@@ -8,13 +8,17 @@ on:
|
|
8
8
|
jobs:
|
9
9
|
release:
|
10
10
|
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
contents: write
|
13
|
+
id-token: write
|
14
|
+
packages: write
|
11
15
|
steps:
|
12
|
-
- uses: actions/checkout@
|
16
|
+
- uses: actions/checkout@v4
|
13
17
|
with:
|
14
18
|
fetch-depth: 0 # Fetch current tag as annotated. See https://github.com/actions/checkout/issues/290
|
15
19
|
- uses: ruby/setup-ruby@v1
|
16
20
|
with:
|
17
|
-
ruby-version:
|
21
|
+
ruby-version: "3.3"
|
18
22
|
- name: "Extract data from tag: version, message, body"
|
19
23
|
id: tag
|
20
24
|
run: |
|
@@ -75,8 +79,8 @@ jobs:
|
|
75
79
|
GEM_HOST_API_KEY: Bearer ${{ secrets.GITHUB_TOKEN }}
|
76
80
|
run: |
|
77
81
|
gem push yabeda-puma-plugin-${{ steps.tag.outputs.version }}.gem --host https://rubygems.pkg.github.com/${{ github.repository_owner }}
|
82
|
+
- name: Configure RubyGems Credentials
|
83
|
+
uses: rubygems/configure-rubygems-credentials@main
|
78
84
|
- name: Publish to RubyGems
|
79
|
-
env:
|
80
|
-
GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_API_KEY }}"
|
81
85
|
run: |
|
82
86
|
gem push yabeda-puma-plugin-${{ steps.tag.outputs.version }}.gem
|
data/.github/workflows/test.yml
CHANGED
@@ -14,40 +14,33 @@ jobs:
|
|
14
14
|
# Skip running tests for local pull requests (use push event instead), run only for foreign ones
|
15
15
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
|
16
16
|
runs-on: ubuntu-latest
|
17
|
+
continue-on-error: ${{ matrix.optional || false }}
|
17
18
|
strategy:
|
18
19
|
fail-fast: false
|
19
20
|
matrix:
|
20
21
|
include:
|
22
|
+
- ruby: head
|
23
|
+
puma: "7"
|
24
|
+
optional: true
|
25
|
+
- ruby: "3.4"
|
26
|
+
puma: "7"
|
27
|
+
- ruby: "3.3"
|
28
|
+
puma: "6"
|
29
|
+
- ruby: "3.2"
|
30
|
+
puma: "6"
|
21
31
|
- ruby: "3.1"
|
22
32
|
puma: "6"
|
23
33
|
- ruby: "3.0"
|
24
34
|
puma: "5"
|
25
35
|
- ruby: "2.7"
|
26
|
-
puma: "5"
|
27
|
-
- ruby: "2.6"
|
28
|
-
puma: "4"
|
29
|
-
- ruby: "2.5"
|
30
36
|
puma: "4"
|
31
|
-
|
32
|
-
|
33
|
-
env:
|
34
|
-
CI: true
|
35
|
-
PUMA_VERSION: ${{ matrix.puma }}
|
37
|
+
env:
|
38
|
+
PUMA_VERSION: ${{ matrix.puma }}
|
36
39
|
steps:
|
37
|
-
- uses: actions/checkout@
|
38
|
-
- uses:
|
40
|
+
- uses: actions/checkout@v4
|
41
|
+
- uses: ruby/setup-ruby@v1
|
39
42
|
with:
|
40
|
-
|
41
|
-
|
42
|
-
restore-keys: |
|
43
|
-
bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
|
44
|
-
bundle-${{ matrix.ruby }}-
|
45
|
-
- name: Upgrade Bundler to 2.0 (for older Rubies)
|
46
|
-
run: gem install bundler -v '~> 2.0'
|
47
|
-
- name: Bundle install
|
48
|
-
run: |
|
49
|
-
bundle config path vendor/bundle
|
50
|
-
bundle install
|
51
|
-
bundle update
|
43
|
+
ruby-version: ${{ matrix.ruby }}
|
44
|
+
bundler-cache: true
|
52
45
|
- name: Run RSpec
|
53
46
|
run: bundle exec rspec
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## 0.8.0 - 2025-09-16
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Puma 7.x support. [@phallstrom][] in [#36](https://github.com/yabeda-rb/yabeda-puma-plugin/pull/36)
|
13
|
+
- `requests_count` metric [@indiebrain][] in [#31](https://github.com/yabeda-rb/yabeda-puma-plugin/pull/31)
|
14
|
+
- `busy_threads` metric [@jbockler][] in [#35](https://github.com/yabeda-rb/yabeda-puma-plugin/pull/35)
|
15
|
+
|
8
16
|
## 0.7.1 - 2022-11-28
|
9
17
|
|
10
18
|
### Fixed
|
@@ -65,3 +73,6 @@ Initial release with basic metrics collection. [@dsalahutdinov]
|
|
65
73
|
[@Neznauy]: https://github.com/Neznauy "Aleksandr Shlyakov"
|
66
74
|
[@Envek]: https://github.com/Envek "Andrey Novikov"
|
67
75
|
[@dsalahutdinov]: https://github.com/dsalahutdinov "Dmitry Salahutdinov"
|
76
|
+
[@indiebrain]: https://github.com/indiebrain "Aaron Kuehler"
|
77
|
+
[@jbockler]: https://github.com/jbockler "Josch Bockler"
|
78
|
+
[@phallstrom]: https://github.com/phallstrom "Philip Hallstrom"
|
data/README.md
CHANGED
@@ -17,8 +17,10 @@ Works as the Puma plugin and provides following metrics:
|
|
17
17
|
Segmented by the worker (index of the worker):
|
18
18
|
- `puma_pool_capacity` - the capacity of each worker: the number of requests that the server is capable of taking right now. More details are [here](https://github.com/puma/puma/blob/0f8b10737e36fc24cdd572f76a739659b5fad9cb/lib/puma/server.rb#L167).
|
19
19
|
- `puma_running` - the number of running threads (spawned threads) for any puma worker
|
20
|
+
- `puma_busy_threads` - the number of busy threads (`running threads` - `how many threads are waiting to receive work` + `how many requests are waiting for a thread to pick them up`)
|
20
21
|
- `puma_max_threads` - preconfigured maximum number of worker threads
|
21
22
|
- `puma_backlog` - the number of backlog threads, the number of connections in that worker's "todo" set waiting for a worker thread.
|
23
|
+
- `puma_requests_count` - the number of requests a worker has served since starting.
|
22
24
|
|
23
25
|
## Installation
|
24
26
|
|
data/lib/puma/plugin/yabeda.rb
CHANGED
@@ -17,8 +17,10 @@ Puma::Plugin.create do
|
|
17
17
|
|
18
18
|
gauge :backlog, tags: %i[index], comment: 'Number of established but unaccepted connections in the backlog', aggregation: :most_recent
|
19
19
|
gauge :running, tags: %i[index], comment: 'Number of running worker threads', aggregation: :most_recent
|
20
|
+
gauge :busy_threads, tags: %i[index], comment: 'Number of busy worker threads', aggregation: :most_recent
|
20
21
|
gauge :pool_capacity, tags: %i[index], comment: 'Number of allocatable worker threads', aggregation: :most_recent
|
21
22
|
gauge :max_threads, tags: %i[index], comment: 'Maximum number of worker threads', aggregation: :most_recent
|
23
|
+
gauge :requests_count, tags: %i[index], comment: 'Number of requests this worker has served since starting', aggregation: :most_recent
|
22
24
|
|
23
25
|
if clustered
|
24
26
|
gauge :workers, comment: 'Number of configured workers', aggregation: :most_recent
|
@@ -37,4 +39,3 @@ Puma::Plugin.create do
|
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
40
|
-
|
@@ -8,6 +8,7 @@ end
|
|
8
8
|
|
9
9
|
require 'uri'
|
10
10
|
require 'rack'
|
11
|
+
require 'logger'
|
11
12
|
|
12
13
|
module Puma
|
13
14
|
class DSL
|
@@ -57,7 +58,9 @@ Puma::Plugin.create do
|
|
57
58
|
[server, logger]
|
58
59
|
}
|
59
60
|
|
60
|
-
|
61
|
+
# after_booted replaces on_booted in Puma 7.0.0
|
62
|
+
after_booted = events.respond_to?(:after_booted) ? :after_booted : :on_booted
|
63
|
+
events.public_send(after_booted) do
|
61
64
|
unless server&.running
|
62
65
|
server, logger = create_server.call
|
63
66
|
logger.log "* Starting #{banner}"
|
@@ -66,16 +69,21 @@ Puma::Plugin.create do
|
|
66
69
|
end
|
67
70
|
|
68
71
|
# on_stopped and on_restart hooks were added in Puma 5.1 in https://github.com/puma/puma/commit/288a4cf756852a4837c77ee70d7fdcca1edb8e82
|
69
|
-
|
72
|
+
# after_stopped and before_restart were added in Puma 7.0.0
|
73
|
+
if (events.respond_to?(:after_stopped) && events.respond_to?(:before_restart)) ||
|
74
|
+
events.respond_to?(:on_stopped) && events.respond_to?(:on_restart)
|
70
75
|
|
71
|
-
events.on_stopped
|
76
|
+
after_stopped = events.respond_to?(:after_stopped) ? :after_stopped : :on_stopped
|
77
|
+
before_restart = events.respond_to?(:before_restart) ? :before_restart : :on_restart
|
78
|
+
|
79
|
+
events.public_send(after_stopped) do
|
72
80
|
if server && !server.shutting_down?
|
73
81
|
logger.log "* Stopping #{banner}"
|
74
82
|
server.stop(true)
|
75
83
|
end
|
76
84
|
end
|
77
85
|
|
78
|
-
events.
|
86
|
+
events.public_send(before_restart) do
|
79
87
|
logger.log "* Restarting #{banner}"
|
80
88
|
server.stop(true)
|
81
89
|
server, logger = create_server.call
|
@@ -2,7 +2,7 @@ module Yabeda
|
|
2
2
|
module Puma
|
3
3
|
module Plugin
|
4
4
|
module Statistics
|
5
|
-
METRICS = [:backlog, :running, :pool_capacity, :max_threads]
|
5
|
+
METRICS = [:backlog, :running, :pool_capacity, :max_threads, :busy_threads, :requests_count]
|
6
6
|
CLUSTERED_METRICS = [:booted_workers, :old_workers, :workers]
|
7
7
|
end
|
8
8
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yabeda-puma-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salahutdinov Dmitry
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yabeda
|
@@ -157,7 +157,7 @@ homepage: http://github.com/yabeda-rb/yabeda-puma-plugin
|
|
157
157
|
licenses:
|
158
158
|
- MIT
|
159
159
|
metadata: {}
|
160
|
-
post_install_message:
|
160
|
+
post_install_message:
|
161
161
|
rdoc_options: []
|
162
162
|
require_paths:
|
163
163
|
- lib
|
@@ -172,8 +172,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
requirements: []
|
175
|
-
rubygems_version: 3.
|
176
|
-
signing_key:
|
175
|
+
rubygems_version: 3.5.22
|
176
|
+
signing_key:
|
177
177
|
specification_version: 4
|
178
178
|
summary: Puma web server plugin for collecting puma metrics with Yabeda framework.
|
179
179
|
test_files: []
|