php / php/php-src

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

Đang mở
#8,880 3 bình luận 3 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Feature SAPI: fpm
Ngôn ngữ chính
C
Star
40.4k
Fork
8.2k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
96

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách lần theo cách FPM phân tích các tham số FastCGI và tạo toàn bộ đầu ra của trang trạng thái. Sử dụng ví dụ nginx fastcgi_param được yêu cầu và đầu ra trạng thái mẫu làm mục tiêu về hành vi. Hoàn thành có nghĩa là siêu dữ liệu của request đã được chấp nhận được hiển thị cho request đang chạy liên quan mà không thay đổi các trường request hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
c, nginx, php
Lĩnh vực
backend, observability
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.