php / php/php-src

Support fastcgi parameter in FPM for status page to display request meta data

オープン
#8,880 コメント 3 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Feature SAPI: fpm
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、FPM が FastCGI パラメーターをどのように解析し、ステータスページの完全な出力を組み立てるかを追跡します。要求された nginx fastcgi_param の例と、サンプルのステータス出力を動作上の目標として使用します。完了とは、既存のリクエストフィールドを変更せずに、該当する実行中のリクエストについて、受け付けられたリクエストメタデータが表示されることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, nginx, php
領域
backend, observability
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。