Skip to content

fix(selfhost): wire or remove the dead gittensory_jobs_deferred_total metric#2574

Merged
JSONbored merged 2 commits into
mainfrom
fix/wire-jobs-deferred-metric
Jul 2, 2026
Merged

fix(selfhost): wire or remove the dead gittensory_jobs_deferred_total metric#2574
JSONbored merged 2 commits into
mainfrom
fix/wire-jobs-deferred-metric

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • gittensory_jobs_deferred_total was registered as a persisted gauge in src/server.ts (reading backend.queue.stats()["gittensory_jobs_deferred_total"]), but no code path in sqlite-queue.ts or pg-queue.ts ever calls recordQueueMetric(driver, "gittensory_jobs_deferred_total", ...) — confirmed both queue drivers only ever record enqueued/processed/failed/dead/rate_limited/rate_limit_deferred/coalesced/recovered, never a bare deferred. Dead instrumentation that always reports 0, giving a false sense that no deferrals are happening.
  • The similarly-named (and actually incremented) gittensory_jobs_rate_limit_deferred_total / gittensory_jobs_rate_limit_admission_deferred_total / gittensory_jobs_rate_limit_budget_deferred_total exist and ARE recorded, so this reads as a leftover/renamed metric from an earlier iteration rather than something intentionally deferred.
  • Confirmed no self-host Grafana dashboard JSON references this metric name (grep -rn "gittensory_jobs_deferred_total" across the repo only matched the one dead registration), so removed the registration rather than inventing new call sites for a metric name nothing currently depends on.

Closes #2508.

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 an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally — src/server.ts is Codecov-ignored, so this one-line removal carries no patch coverage obligation.
  • 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 — N/A, a pure removal with no behavior change to verify.

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. — N/A.
  • API/OpenAPI/MCP behavior is updated and tested where needed. — N/A, internal metrics registration only.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. — N/A, no UI changes.
  • Visible UI changes include a UI Evidence section below — N/A, no UI changes.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

Notes

@dosubot dosubot Bot added the size:XS label Jul 2, 2026
@loopover-orb

loopover-orb Bot commented Jul 2, 2026

Copy link
Copy Markdown

Tip

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

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-02 10:32:11 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
The change removes the unrecorded `gittensory_jobs_deferred_total` persisted gauge and adds a focused regression test that ties the server registration list to real queue-driver recording call sites. The visible diff is coherent with the PR description, and the removed metric is not replaced by a fabricated runtime path. The main caveat is that the new test is intentionally source-text based, so its matcher should stay broad enough to catch future valid metric names.

Nits — 3 non-blocking
  • nit: test/unit/server-persisted-job-metrics.test.ts:22 extracts quoted metric names with `/"([a-z_]+)"/g`, which would silently skip any future valid Prometheus metric containing digits.
  • test/unit/server-persisted-job-metrics.test.ts:22: broaden the metric-name regex to include digits after the first character, or parse the literal array more explicitly so future registrations cannot evade the invariant.
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2508
Related work ⚠️ 2 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (size label size:XS; 1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 65 registered-repo PR(s), 55 merged, 553 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 65 PR(s), 553 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Review top overlaps.
  • Add a concise scope and risk note.
  • No action.
  • Check active issues and PRs before submitting.
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.

🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@JSONbored JSONbored self-assigned this Jul 2, 2026
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 2, 2026
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.98%. Comparing base (c0e8660) to head (484e3aa).
⚠️ Report is 22 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2574      +/-   ##
==========================================
+ Coverage   95.97%   95.98%   +0.01%     
==========================================
  Files         226      229       +3     
  Lines       25533    25810     +277     
  Branches     9293     9389      +96     
==========================================
+ Hits        24505    24774     +269     
- Misses        417      425       +8     
  Partials      611      611              

see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

JSONbored added 2 commits July 2, 2026 03:17
gittensory_jobs_deferred_total was registered as a persisted gauge in
server.ts (reading backend.queue.stats()["gittensory_jobs_deferred_total"])
but no code path in sqlite-queue.ts or pg-queue.ts ever calls
recordQueueMetric(driver, "gittensory_jobs_deferred_total", ...) --
dead instrumentation that always reports 0. The similarly-named (and
actually incremented) gittensory_jobs_rate_limit_deferred_total /
gittensory_jobs_rate_limit_admission_deferred_total /
gittensory_jobs_rate_limit_budget_deferred_total exist and ARE
recorded, so this reads as a leftover/renamed metric from an earlier
iteration rather than something intentionally deferred.

No self-host Grafana dashboard JSON references this metric name, so
remove the dead gauge registration rather than inventing new call
sites for a metric name nothing currently depends on.
Address the gate review's test-expectations concern on the dead
gittensory_jobs_deferred_total removal directly, rather than treating
it as a policy-heuristic override: assert every metric name in
server.ts's persisted-gauge list has a real recordQueueMetric call
site in both queue drivers, so a future dead entry can't reappear the
same way without a test catching it.
@JSONbored
JSONbored force-pushed the fix/wire-jobs-deferred-metric branch from 2571c31 to 484e3aa Compare July 2, 2026 10:20
@JSONbored
JSONbored merged commit 7c75d9b into main Jul 2, 2026
13 checks passed
@JSONbored
JSONbored deleted the fix/wire-jobs-deferred-metric branch July 2, 2026 10:36
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.

Development

Successfully merging this pull request may close these issues.

fix(selfhost): wire or remove the dead gittensory_jobs_deferred_total metric

1 participant