frankenphp icon indicating copy to clipboard operation
frankenphp copied to clipboard

add basic metrics

Open withinboredom opened this issue 1 year ago • 0 comments

This adds a collection of basic metrics based on feedback in #269:

  • frankenphp_busy_threads: shows current php threads processing php scripts (including workers waiting for requests)
  • frankenphp_total_threads: shows the total number of running php threads
  • frankenphp_[worker]_busy_workers: shows how many workers are currently processing requests
  • frankenphp_[worker]_total_workers: shows the total amount of workers.
  • frankenphp_[worker]_worker_request_count: shows the total requests processed by each worker
  • frankenphp_[worker]_worker_request_time: shows the total time taken processing requests

Currently, it uses the filename of the registered worker as a key. Ideally, the user would be able to name the worker and use that instead. I'm not sure if we want to do that in this PR.

Here's currently one worker running on my machine:

# HELP frankenphp_busy_threads Number of busy PHP threads
# TYPE frankenphp_busy_threads gauge
frankenphp_busy_threads 32
# HELP frankenphp_total_threads Total number of PHP threads
# TYPE frankenphp_total_threads counter
frankenphp_total_threads 33
# HELP frankenphp_worker_busy_workers Number of busy PHP workers for this worker
# TYPE frankenphp_worker_busy_workers gauge
frankenphp_worker_busy_workers 1
# HELP frankenphp_worker_total_workers Total number of PHP workers for this worker
# TYPE frankenphp_worker_total_workers gauge
frankenphp_worker_total_workers 32
# HELP frankenphp_worker_worker_request_count
# TYPE frankenphp_worker_worker_request_count counter
frankenphp_worker_worker_request_count 40
# HELP frankenphp_worker_worker_request_time
# TYPE frankenphp_worker_worker_request_time counter
frankenphp_worker_worker_request_time 0.0012

withinboredom avatar Aug 11 '24 12:08 withinboredom