-
Notifications
You must be signed in to change notification settings - Fork 8k
Add openmtrics formatting to fpm status #5723
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 openmtrics formatting to fpm status #5723
Conversation
|
I have been just thinking about this few days ago and now I see the PR. :) I support the idea and I'd be happy to merge this in once finished and if I don't see any issue during review. |
|
@bukka Great! Just need to figure out testing, and get it ready for review. |
|
You just need to add a format php-src/sapi/fpm/tests/tester.inc Line 502 in bc4201f
and then create checkStatusPrometheus in status.inc in a similar way like the one for json: php-src/sapi/fpm/tests/status.inc Lines 180 to 199 in bc4201f
|
|
@WyriHaximus would you be able to create a normal PR and squash all your commits. I'd like to merge it before feature freeze which is on 4th Aug. It's in few days so I'd be happy to get it in without test and add test and possibly some tweaks later. |
d561130 to
bd87d82
Compare
|
@bukka Done. Was planning to look into the tests tomorrow or Wednesday, but this also works for me. Will look into those anyway whether this PR is merged or not by then. |
|
Ok thanks. I plan to merge it on Monday so if you get time tomorrow and manage to add it, then great! Otherwise you can create a new PR after it's in. |
|
@bukka Got a decent stab at the tests, not ensure clear how it works yet but got them up and running. Will continue Wednesday and hope to have some working tests then :). |
|
Hmm so I was just looking into this a bit more closely and also testing it. It actually doesn't work. The format syntax doesn't look like format that is supported. At least it doesn't work with the |
|
@bukka Would we still be able to get it into |
|
@bukka Also I completely forgot about this, but the |
|
From a quick look to https://github.com/php/php-src/blob/e0fa48f69dd14b52c8f1b2904ac7bd30472849a8/main/spprintf.c I don't think there is such way unless I missed something. Probably better to use a separate call for prometheus format and add pool multiple times. In terms of FF I would be fine as it is quite self contained but it depends on the release managers if they allow it during beta. |
sapi/fpm/fpm/fpm_status.c
Outdated
| proc.request_stage == FPM_REQUEST_ACCEPTING ? cpu : 0., | ||
| proc.request_stage == FPM_REQUEST_ACCEPTING ? proc.memory : 0); | ||
| proc.request_stage == FPM_REQUEST_ACCEPTING ? proc.memory : 0, | ||
| scoreboard.pool); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is specific to prometheus so it shouldn't be probably added for all...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the current pool will be showed on the status page correct? Because then we can indeed drop it off and it will make things a lot easier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll have a look at that, thanks 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry commented from the wrong account so needed to remove that account from reviewers.
For reference was saying that it will be fixed by the changes for the spprintf :)
|
Ok progress, think I have it working (extracting this from the tests): Looking into fixing those now. And if they work I'll look into getting the pool in there correctly |
642e4fd to
aa57253
Compare
Yeah will look into that next, for now I got it into a mostly acceptable shape IMHO. Just spotted one-off indention but will fix that tomorrow morning. Also have some work ready to add the pool, but got some
Lets see and hope @carusogabriel things this is small enough to be allowed to land during beta 🤞 |
39bf17f to
9e69627
Compare
|
@bukka @carusogabriel Right so validated metric using |
|
@WyriHaximus The travis test failure seems related to this PR (status-basic.phpt is failing). |
|
@bukka Yup, there is still something off about the pattern in there. Interestingly enough the CI's don't show the reason. Let me run it locally again and comment the output of the report here |
|
|
Hi guys! Thanks a lot for this amazing missing feature! How can I help you? Have a good day 🚀 |
|
Hey @JulienBreux so the thing that this PR is currently stuck at is failing tests. So if you have insights how to get them to pass that would be great. Also since it didn't make the PHP 8.0 feature freeze it will take until PHP 8.1 to get in (so give or take a year), I wasn't in a hurry to get it finished after missing that deadline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silly me, escaped the wrong thing
307f5f9 to
93cf3e4
Compare
|
Thanks for the help getting the tests fixed @lcobucci 👍 ! |
My pleasure, @WyriHaximus. This is a great idea and will help us to instrument PHP infra in a much simpler way. |
93cf3e4 to
40cf629
Compare
|
Everything is green? Can we merge? :) |
|
@mfn Think so, but want to do one more review of it this weekend before I'm fully comfortable with it :D |
|
Merged via d36ac96 . Thanks! |
|
status-basic.phpt and status-listen.phpt fail on MACOS_DEBUG_ZTS and DEBUG_ZTS_MSAN: https://dev.azure.com/phpazuredevops/PHP/_build/results?buildId=15461&view=ms.vss-test-web.build-test-results-tab&runId=353212&paneView=debug&resultId=115352 |
|
@WyriHaximus I'm wondering if there's much point to have the timestamp at all. As I needed to create another conditional branch for that, think we could just omit it completely as I'm not sure if it's useful. I was looking to https://github.com/hipages/php-fpm_exporter#metrics-collected and it has got just I'm also wondering if it would make sense to sync the metric names between this exporter (as it's probably the most popular one that I'm aware of) and what's in FPM now. That could make migration easier possibly. What do you think? One more thing that came to my mind. Would it make sense to add a pool name as a label. I remember that you had it implemented initially, right? |
Fine by me 👍 .
Agreed 👍 . Also what are your thoughts on https://github.com/hipages/php-fpm_exporter#why---phpfpmfix-process-count ?
Yes, I also included the code for support |
|
@WyriHaximus PR created: #7291 to sync the metrics names and remove start timestamp.
This is really a bug that should be addressed. Will add it on my TODO list :) |
|
@bukka Sweet, let me have a look! |

Todo: