Files
frankenphp/docs/metrics.md
Rob Landers 5d43fc2c8d add basic metrics (#966)
* add metrics

* change how counting works

* also replace dots

* check that metrics exist

* rename NullMetrics to nullMetrics

* update go.sum

* register collectors only once

* add tests

* add tests for metrics and fix bugs

* keep old metrics around for test

* properly reset during shutdown

* use the same method as frankenphp

* Revert "keep old metrics around for test"

This reverts commit 1f0df6f6bdaebf32aec346f068d6f42a0b5f4007.

* change to require.NoError

* compile regex only once

* remove name sanitizer

* use require

* parameterize host port because security software sucks

* remove need for renaming workers

* increase number of threads and add tests

* fix where frankenphp configuration was bleeding into later tests

* adds basic docs for metrics

* Add caddy metrics link

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* Fix typos

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* address feedback

* change comment to be much more "dangerous"

---------

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2024-09-26 09:53:37 +02:00

773 B

Metrics

When Caddy metrics are enabled, FrankenPHP exposes the following metrics:

  • frankenphp_[worker]_total_workers: The total number of workers.
  • frankenphp_[worker]_busy_workers: The number of workers currently processing a request.
  • frankenphp_[worker]_worker_request_time: The time spent processing requests by all workers.
  • frankenphp_[worker]_worker_request_count: The number of requests processed by all workers.
  • frankenphp_total_threads: The total number of PHP threads.
  • frankenphp_busy_threads: The number of PHP threads currently processing a request (running workers always consume a thread).

For worker metrics, the [worker] placeholder is replaced by the worker script path in the Caddyfile.