Conversation
As a first step towards cleaning up the current logic we extract plaintext handling into its own static function.
This file contains hidden or 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
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.
Closes #9494, alternative to #12759
The former logic was quite a mess and I saw no way to fit the OpenMetrics per-worker stats into the existing control flow, so I extracted each format handling into its own static function and
fpm_status_handle_request()became a simple dispatcher to the specialized handler. For text/html/xml/json these functions are a bit repetitive, but for OpenMetrics this design allows the flexibility to have a different control flow that doesn't interfere with the other formats.The new metrics try to follow those of php-fpm_exporter as close as possible with only very minor differences (the
scrape_urilabel is not present, and the state "Getting request informations" is now "Getting request information" as per the existing constants in FPM.phpfpm_scrape_failuresis also not present).I tried to organize the commits to ease review, each one does a logical step and compiles and passes the tests.
I also fixed a subtle bug in the existing OpenMetrics output, for phpfpm_listen_queue_length the HELP and TYPE annotations were swapped, that's why I had to amend fpm/tests/status.inc.