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
Add HELP and TYPE lines to the legacy stats Prometheus text #2734
Make the Prometheus text of GET /api/v1/stats?format=prometheus follow the ADR rule that every Prometheus text of the tracker carries # HELP and # TYPE for each metric family, without changing any metric name or value.
Background
The ADR "Define the stats and metrics endpoints and require HELP and TYPE in Prometheus output" (merged with #2727) decided that /stats is not deprecated and that every Prometheus text the tracker exports must carry # HELP and # TYPE. It recorded the legacy /stats text as a known exception and named this issue as the follow-up.
#2719 made the text parseable. Today the 32 lines are bare name value pairs, so every metric is untyped and promtool check metrics reports "no help text" for each (exit code 3). Every Stats field already has a doc comment that describes it.
Proposal
Print # HELP and # TYPE before each sample line, in the order of the JSON fields.
Choose a type (gauge or counter) and one description per name; keep the names unchanged (API v1).
Keep one source for the descriptions shared with the Stats documentation.
Update the tests and the stats module docs, then recheck with Prometheus 3.5.0 and promtool (target: exit code 0, 32 samples, target up).
The full specification, including the proposed type table and options, is in docs/issues/open/2734-stats-prometheus-text-help-and-type/ISSUE.md (added by the spec PR).
Note on AC4: with HELP and TYPE, promtool check metrics 3.5.0 exits 3, not 0. No "no help text" or type warning remains; the 28 warnings are naming lint on frozen API v1 names (24 counters without _total, 3 *_ns abbreviated units, the gauge udp_banned_ips_total). Renaming is a breaking change of API v1, so by the maintainer's decision AC4 was amended and the rename is written down for the next API version (spec section "Next API version", doc comment on STATS_DESCRIPTIONS).
Activity
docs(issues): [#2734] add the specification to add HELP and TYPE to t…
Merge #2738: docs(issues): [#2734] add the specification to add HELP …
josecelano-bot commentedon Nov 5, 2026
Implemented in #2741.
Note on AC4: with HELP and TYPE,
promtool check metrics3.5.0 exits 3, not 0. No "no help text" or type warning remains; the 28 warnings are naming lint on frozen API v1 names (24 counters without_total, 3*_nsabbreviated units, the gaugeudp_banned_ips_total). Renaming is a breaking change of API v1, so by the maintainer's decision AC4 was amended and the rename is written down for the next API version (spec section "Next API version", doc comment onSTATS_DESCRIPTIONS).refactor(rest-api): [torrust#2734] declare the stats fields, their do…
test(axum-rest-api-server): [#2734] expect HELP and TYPE in the legac…
feat(rest-api): [#2734] add HELP and TYPE to the legacy stats Prometh…
docs(rest-api): [#2734] show HELP and TYPE in the stats module docs
docs(issues): [#2734] record verification evidence and the next-API-v…
chore(issues): [#2734] archive the closed spec and update the ADR
Merge #2743: chore(issues): [#2734] archive the closed spec and updat…
Merge torrust#2741: feat(rest-api): [torrust#2734] add HELP and TYPE …