[php-src] Issue #8880: Support fastcgi parameter in FPM for status page to display request meta data
| From: | nedt | Date: | Mon, 27 Jun 2022 16:16:05 +0000 |
| Subject: | [php-src] Issue #8880: Support fastcgi parameter in FPM for status page to display request meta data | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241819@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8880
Author: nedt
### Description
The full FPM status page has very little request data to pinpoint actual running requests and see
what's running to get some indication of pool health issues.
It starts with the request uri that actually just shows the request from php, but not the original
request - i.e. with a typical front controller pattern it's just something like
/front.php. There is already a bug report for that: https://bugs.php.net/bug.php?id=72319 , but
I'd suggest that it could stay the same if the real request uri could be added as meta data.
In addition to data a fastcgi param could also be used for different meta data like a client up,
nginx request id, etc. It's content and meaning would be in total control of the one using it.
FPM itself wouldn't need to do more than showing it in the full status page.
A concrete usage would look like this in a nginx config (param name just for presentation purpose):
fastcgi_param FPM_STATUS_REQUEST_METADATA "$remote_addr $request_id
$request_uri";
which would result in an output like that:
```
[...]
************************
pid: 1234
state: Running
start time: 27/Jun/2022:00:00:00 +0000
start since: 0
requests: 1
request duration: 10
request method: GET
request URI: /front.php
content length: 100
user: -
script: /httpdocs/front.php
last request cpu: 0.00
last request memory: 0
request metadata: 127.0.0.1 A1B2D3E4F5 /hello/world
************************
[...]
```
Note: Of course a workaround is sending this as get parameters, but that's not pretty and can
break scripts assuming a specific format of the query string or not seeing unknown get parameters.