Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add requests_count measure #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Segmented by the worker (index of the worker):
- `puma_running` - the number of running threads (spawned threads) for any puma worker
- `puma_max_threads` - preconfigured maximum number of worker threads
- `puma_backlog` - the number of backlog threads, the number of connections in that worker's "todo" set waiting for a worker thread.
- `puma_requests_count` - the number of requests a worker has served since starting.

## Installation

Expand Down
2 changes: 1 addition & 1 deletion lib/puma/plugin/yabeda.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def start(launcher)
gauge :running, tags: %i[index], comment: 'Number of running worker threads', aggregation: :most_recent
gauge :pool_capacity, tags: %i[index], comment: 'Number of allocatable worker threads', aggregation: :most_recent
gauge :max_threads, tags: %i[index], comment: 'Maximum number of worker threads', aggregation: :most_recent
gauge :requests_count, tags: %i[index], comment: 'Number of requests this worker has served since starting', aggregation: :most_recent

if clustered
gauge :workers, comment: 'Number of configured workers', aggregation: :most_recent
Expand All @@ -37,4 +38,3 @@ def start(launcher)
end
end
end

2 changes: 1 addition & 1 deletion lib/yabeda/puma/plugin/statistics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Yabeda
module Puma
module Plugin
module Statistics
METRICS = [:backlog, :running, :pool_capacity, :max_threads]
METRICS = [:backlog, :running, :pool_capacity, :max_threads, :requests_count]
CLUSTERED_METRICS = [:booted_workers, :old_workers, :workers]
end
end
Expand Down
8 changes: 5 additions & 3 deletions spec/yabeda/puma/plugin/statistics/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"worker_status"=>[
{"pid"=>13, "index"=>0, "phase"=>0, "booted"=>true, "last_checkin"=>"2019-03-31T13:04:28Z",
"last_status"=>{
"backlog"=>0, "running"=>5, "pool_capacity"=>5, "max_threads"=>5
"backlog"=>0, "running"=>5, "pool_capacity"=>5, "max_threads"=>5, "requests_count" => 5,
}},
{"pid"=>17, "index"=>1, "phase"=>0, "booted"=>true, "last_checkin"=>"2019-03-31T13:04:28Z",
"last_status"=>{
"backlog"=>0, "running"=>5, "pool_capacity"=>5, "max_threads"=>5
"backlog"=>0, "running"=>5, "pool_capacity"=>5, "max_threads"=>5, "requests_count" => 5,
}
}
]
Expand All @@ -36,11 +36,13 @@
{ name: 'running', labels: {index: 0}, value: 5 },
{ name: 'pool_capacity', labels: {index: 0}, value: 5 },
{ name: 'max_threads', labels: {index: 0}, value: 5 },
{ name: 'requests_count', labels: {index: 0}, value: 5},

{ name: 'backlog', labels: {index: 1}, value: 0 },
{ name: 'running', labels: {index: 1}, value: 5 },
{ name: 'pool_capacity', labels: {index: 1}, value: 5 },
{ name: 'max_threads', labels: {index: 1}, value: 5 }
{ name: 'max_threads', labels: {index: 1}, value: 5 },
{ name: 'requests_count', labels: {index: 1}, value: 5},
]
)
end
Expand Down