Skip to content

fix(observability): correct LoopoverOrbExportErrorRateHigh's stale runbook metric name - #6094

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
galuis116:fix/orb-runbook-stale-metric-name
Jul 15, 2026
Merged

fix(observability): correct LoopoverOrbExportErrorRateHigh's stale runbook metric name#6094
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
galuis116:fix/orb-runbook-stale-metric-name

Conversation

@galuis116

Copy link
Copy Markdown
Contributor

Summary

  • LoopoverOrbExportErrorRateHigh's runbook annotation in prometheus/rules/alerts.yml told operators to compare loopover_orb_events_recorded_total against _exported_total to confirm a stuck exporter, but no "recorded" counter was ever registered — only loopover_orb_events_exported_total and loopover_orb_export_errors_total exist (src/selfhost/orb-collector.ts, src/selfhost/metrics.ts). An operator paged by this alert who followed the runbook literally got an empty Prometheus series.
  • Rephrases the runbook to point at the two real metrics already used in the alert's own expr, per the issue's own suggested fix — no other change to the alert.
  • Adds a general regression check (test/unit/alerts-metric-name-references.test.ts) that scans every loopover_*-shaped token in every alert's annotation text (summary/description/runbook) across prometheus/rules/alerts.yml and asserts each one resolves to a registered metric (src/selfhost/metrics.ts's DEFAULT_METRIC_META), a documented external-source prefix (loopover_backup_* the backup exporter, loopover_d1_* the opt-in Cloudflare D1 probe, loopover_miner_* the miner CLI's own pushed metrics), or a recognized label-wildcard family reference (a trailing *, e.g. loopover_jobs_rate_limit_*).
  • The new test includes both the pass case (the real file, confirmed zero dangling references after this fix) and a fail case (a synthetic fixture with a fabricated metric name), proving the checker actually catches this class of drift rather than trivially passing.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Closes #5816

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • The local machine is under persistent memory contention from multiple concurrent processes on this shared box, and the full npm run test:ci chain's local tsc --noEmit step OOM-crashes reproducibly. This PR changes zero application .ts/.js source logic — only a YAML annotation string and one new self-contained test file (readFileSync/yaml's parse, mirroring test/unit/alerts-job-failure-ratio-formula.test.ts's own alerts.yml-parsing pattern already in the suite). What I could run locally is green: actionlint, db:migrations:check, npm run selfhost:validate-observability (the existing PromQL/dashboard validator, confirms the YAML edit is still valid), npm audit, and the new test file plus a sibling alerts-*.test.ts in isolation via npx vitest run — all pass, including the fail-case fixture proving the new check works. CI's validate-code/validate-tests jobs run on GitHub's own isolated runners with no such contention and will independently confirm the rest (typecheck included) before merge — the same pattern used successfully for PR fix(selfhost): correct stale gittensory_ metric names in .env.example #6079 earlier this session.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

Not applicable: this is an observability-config + test-only change, no UI/auth/session/API surface touched.

Notes

  • Per the issue's own scope note, this does not invent/register a new loopover_orb_events_recorded_total metric — the runbook is corrected to describe real, already-registered metrics instead.

…nbook metric name (JSONbored#5816)

The runbook told operators to compare loopover_orb_events_recorded_total
against _exported_total to confirm a stuck exporter, but no
"recorded" counter was ever registered -- only
loopover_orb_events_exported_total and loopover_orb_export_errors_total
exist (src/selfhost/orb-collector.ts). Rephrases the runbook to point
at the two real metrics already in the alert's own expr.

Adds a general regression check (test/unit/alerts-metric-name-references.test.ts)
that scans every loopover_*-shaped token in every alert's annotation
text in prometheus/rules/alerts.yml and asserts it resolves to a
registered metric (src/selfhost/metrics.ts), a documented external
prefix (backup exporter, opt-in D1 probe, miner CLI), or a recognized
label-wildcard family -- so a future stale/renamed metric reference in
annotation prose fails CI instead of shipping unnoticed.
@galuis116
galuis116 requested a review from JSONbored as a code owner July 15, 2026 09:07
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.24%. Comparing base (332969e) to head (2bcd40a).
⚠️ Report is 17 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6094      +/-   ##
==========================================
+ Coverage   95.23%   95.24%   +0.01%     
==========================================
  Files         595      595              
  Lines       47013    47032      +19     
  Branches    15015    15012       -3     
==========================================
+ Hits        44771    44794      +23     
  Misses       1493     1493              
+ Partials      749      745       -4     
Flag Coverage Δ
shard-1 43.96% <ø> (+0.01%) ⬆️
shard-2 36.60% <ø> (+0.02%) ⬆️
shard-3 31.96% <ø> (+<0.01%) ⬆️
shard-4 33.79% <ø> (+0.01%) ⬆️
shard-5 31.46% <ø> (-0.01%) ⬇️
shard-6 44.83% <ø> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 15, 2026
@loopover-orb

loopover-orb Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-15 09:21:08 UTC

2 files · 1 AI reviewer · no blockers · readiness 98/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This fixes a genuine documentation drift: the runbook previously referenced a non-existent `loopover_orb_events_recorded_total` metric, which would send an operator paged by this alert to an empty Prometheus series. The new runbook text correctly points to the two metrics actually used in the alert's own `expr` (`loopover_orb_export_errors_total` and `loopover_orb_events_exported_total`). The accompanying regression test is well-constructed, scanning all annotation text for `loopover_*` tokens and verifying they resolve to registered metrics, documented external prefixes, or wildcard families, with both a passing real-file case and a fabricated-metric fail case proving the checker works.

Nits — 5 non-blocking
  • The `EXTERNAL_METRIC_PREFIXES` and wildcard-family allowlist in the test are hand-maintained; if a new external-source prefix or wildcard family is added to alerts.yml without updating this list, the test will fail with a slightly confusing 'unknown token' error rather than a clear message pointing at the allowlist (test/unit/alerts-metric-name-references.test.ts).
  • The `METRIC_TOKEN_PATTERN` regex could theoretically match partial words embedded in larger identifiers/URLs if such ever appear in annotation prose, though this is unlikely given current alert text.
  • Consider adding a short comment near `EXTERNAL_METRIC_PREFIXES` noting that it must be updated in lockstep with any new external metric source added to alerts.yml, to make future maintenance obvious.
  • The test file's block comment could be trimmed to a single-line summary per repo comment conventions.
  • Possible secret-shaped assignment in the diff (generic_secret_assignment) — Verify the value is not a real credential.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #5816
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 1909 registered-repo PR(s), 1260 merged, 50 issue(s).
Contributor context ✅ Confirmed Gittensor contributor galuis116; Gittensor profile; 1909 PR(s), 50 issue(s).
Gate result ✅ Passing No configured blocker found.
Improvement ℹ️ Insufficient signal risk: clean · value: insufficient-signal · LLM: moderate
Linked issue satisfaction

Addressed
The runbook text is rewritten to reference only the two real metrics (loopover_orb_export_errors_total and loopover_orb_events_exported_total) as suggested, and a new test scans all annotation text in alerts.yml against DEFAULT_METRIC_META plus documented external prefixes, with both pass and fabricated-metric fail cases.

Review context
  • Author: galuis116
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: JavaScript, Python, Dart, TypeScript, HTML, MDX, Rust, C++
  • Official Gittensor activity: 1909 PR(s), 50 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit f663f18 into JSONbored:main Jul 15, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(observability): LoopoverOrbExportErrorRateHigh runbook references a metric that doesn't exist

1 participant