You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
frankenphp_total_threads is registered as a Counter but is semantically a Gauge #2481
The frankenphp_total_threads metric is registered as a Prometheus Counter, but its value is semantically a Gauge — it reflects the current configured PHP thread-pool size, which only changes on (re)configuration, not a monotonically increasing total.
By contrast, the sibling thread metrics frankenphp_busy_threads and frankenphp_queue_depth are correctly registered with prometheus.NewGauge.
Two problems follow from the Counter registration:
The exposition emits # TYPE frankenphp_total_threads counter. Prometheus-conformant consumers (Datadog's OpenMetrics V2 check, Grafana Agent, etc.) honor the declared type and treat it as a rate / apply .as_count(), so a steady non-incrementing value reads as 0. Today consumers must add an explicit per-metric type: gauge override to recover the real value.
The update path uses Counter.Add(num), so any call to TotalThreads(num) after the first accumulates rather than reporting the current pool size — incorrect once the thread count changes (e.g. thread autoscaling / reconfiguration).
Reproduction
Enable metrics (e.g. servers { metrics }) and scrape the metrics endpoint:
This matches the existing treatment of busy_threads / queue_depth and lets standard Prometheus consumers read it correctly without per-metric type overrides.
PR welcome! This is likely an artifact from before frankenphp could stop threads permanently (a long time ago, in a repo far away, they could only be restarted).
Activity
withinboredom commentedon Jul 5, 2026
PR welcome! This is likely an artifact from before frankenphp could stop threads permanently (a long time ago, in a repo far away, they could only be restarted).
fix: report total threads as gauge (php#2550)