-
Notifications
You must be signed in to change notification settings - Fork 5
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 Pitchfork/Raindrops middleware #66
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add listener_address as Instance attributes of Promenade::Raindrops::Stats Fix guard clauses 💇♀️ Update dev dependencies Update Bundler version
I think the complexity in the setup method is unavoidable, and trying to factor this logic into another method doesn't improve anything. The assignment in if conditions stuff is a bit suspect, but I don't really mind it ...
Add listener_address as Instance attributes of Promenade::Raindrops::Stats Fix guard clauses 💇♀️ Update dev dependencies Update Bundler version
robertomiranda
force-pushed
the
r/pitchfork-middleware
branch
4 times, most recently
from
August 16, 2024 11:45
4037942
to
590395e
Compare
Remove Periodic Stats Fix rebase Ignore railties add codecove yml path Remove unused settings Ignore Railtie from codecove Update codecove Add Codecov yml path Ignore railtie with Simplecov
robertomiranda
force-pushed
the
r/pitchfork-middleware
branch
from
August 19, 2024 14:30
7733dc8
to
426a6f3
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #66 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 34 37 +3
Lines 761 833 +72
=========================================
+ Hits 761 833 +72 ☔ View full report in Codecov by Sentry. |
errm
approved these changes
Aug 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Pitchfork/Raindrops middleware. This PR depends on the changes made in #63. However, it removes the Periodic Stats class introduced previously, considering the feedback on the previous PR. We can periodically collect metrics, relying on the health checks performed on the Rails application.
Note: I'm not testing the changes made to Railties because they are too complex and add little value. Instead, I'm proposing to ignore it
Promenade::Raindrops::Middleware
The
Promenade::Raindrops::Middleware
middleware collects and reports metrics fromPromenade::Raindrops::Stats
. ThePromenade::Raindrops::Stats
exposes active workers and queued requests in servers like Rainbows, Unicorn, and Pitchfork using Prometheus gauges. It initializes by obtaining TCP listener stats fromRaindrops::Linux
, setting the listener address, and fetching active worker and queued request counts. Theinstrument
method updates the Prometheus gauges with these values, and the class methodself.instrument
allows easy instrumentation with an optional listener address.rack_active_workers
: Number of active workers in the Application Serverrack_queued_requests
: Number of requests waiting to be processed by the Application ServerPromenade::Pitchfork::Middleware
The
Promenade::Pitchfork::Middleware
class collects and reports metrics using thePromenade::Pitchfork::Stats
class. ThePromenade::Pitchfork::Stats
exports the Pitchfork worker processes using Prometheus gauges. It tracks the total, live, idle, and busy worker counts. The class retrieves these metrics usingPitchfork::Info
andRaindrops::Stats
, and updates the Prometheus gauges accordingly.pitchfork_workers_count
: Total number of configured workers.pitchfork_live_workers_count
: Number of live (booted) workers.pitchfork_capacity
: Number of idle workers.pitchfork_busy_percent
: Percentage of busy workers.