Skip to content

docs(issues): [#2734] add the specification to add HELP and TYPE to the legacy stats text - #2738

Merged
josecelano merged 1 commit into
torrust:developfrom
josecelano-bot:2734-stats-prometheus-text-help-and-type-spec
Nov 5, 2026
Merged

josecelano merged 1 commit into
torrust:developfrom
josecelano-bot:2734-stats-prometheus-text-help-and-type-spec

Conversation

@josecelano-bot

Copy link
Copy Markdown
Contributor

Summary

Adds the specification for #2734: print # HELP and # TYPE before each metric of the legacy GET /api/v1/stats?format=prometheus text, as the accepted ADR "Define the stats and metrics endpoints and require HELP and TYPE in Prometheus output" requires.

Spec only: no code changes. It proposes a type for each of the 32 names, options for a single source of the descriptions, the regression test strategy and the real-artifact recheck. Metric names and values do not change.

Related to #2734

🤖 Generated with Claude Code

…PE to the legacy stats text

Specify the follow-up of the ADR that requires HELP and TYPE in every Prometheus
text: the proposed types, the options for a single description source, the
tests and the real-artifact recheck.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@josecelano
josecelano requested review from da2ce7 and a balanced review from Copilot November 5, 2026 17:26
@josecelano josecelano self-assigned this Nov 5, 2026
@josecelano

Copy link
Copy Markdown
Member

ACK eadadd1

@josecelano
josecelano merged commit 47ed159 into torrust:develop Nov 5, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The plan’s zero-warning gate conflicts with frozen legacy metric names, and its validation process omits required incremental reviews and initial bug-reproduction evidence.

3 open issues
What changed in this PR

Adds the specification for #2734 to bring legacy /api/v1/stats?format=prometheus output into line with the accepted HELP/TYPE requirement. This is documentation only; no runtime behavior changes.

Changes:

  • Proposes types for all 32 metrics while preserving existing names and values.
  • Evaluates a shared source for metric descriptions and Stats documentation.
  • Defines implementation tasks, regression tests, and real-artifact verification.
File Description
docs/​issues/​open/​2734-stats-prometheus-text-help-and-type/​ISSUE.md Adds the scope, design options, implementation plan, and acceptance criteria for legacy metric metadata.

Review effort: Balanced

Comment on lines +93 to +95
Unit tests on `metrics_response` (pure over `Stats`): every sample line is preceded by one `# HELP` and one `# TYPE` line for the
same name; every name has exactly one type from the table; the body still ends with a line feed. Red first, then the change. The
existing pinned test for the exact text changes on purpose in the same PR.
Comment on lines +101 to +102
| T1 | PENDING | Maintainer decides the option and the types | Decision recorded in this spec |
| T2 | PENDING | Add the failing tests (red) | Fail on the missing `# HELP` and `# TYPE` lines |
- [ ] AC1: Every metric of `GET /api/v1/stats?format=prometheus` has one `# HELP` and one `# TYPE` line before its sample.
- [ ] AC2: Names and values are unchanged from the current text.
- [ ] AC3: The descriptions have one source shared with the `Stats` documentation.
- [ ] AC4: `promtool check metrics` reports no warnings (exit code `0`) and Prometheus 3.x scrapes 32 samples with the target `up`.
@da2ce7

da2ce7 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Post-merge note: this pull request requested a review from this account and was closed without one at its final head. A post-merge review will not be done: It added only an issue specification under docs/issues/, with no executable code, build or CI effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants