Support fastcgi parameter in FPM for status page to display request meta data
还没有人认领这个 Issue。
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先跟踪 FPM 如何解析 FastCGI 参数并组装完整的状态页面输出。使用所请求的 nginx fastcgi_param 示例和状态输出示例作为行为目标。完成标准是:在不更改现有请求字段的情况下,针对相关的正在运行的请求显示已接受的请求元数据。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, nginx, php
- 领域
- backend, observability
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100