Repository navigation
[P2] UI: Drive stage Active/Running/Standby badges from live metrics - #1687
Open
BenjaminSRussell wants to merge 1 commit into
Open
BenjaminSRussell wants to merge 1 commit into
BenjaminSRussell wants to merge 1 commit into
Conversation
Fixes #384 Overview stage cards and the System Health stage rows hardcoded their badges (Pending/Running/Standby), so a stalled or partially-down stage still showed Running. Add stageBadgeStates() in format-utils.js and apply it from updateDashboard via applyStageBadges(): - Running when the stage's per-interval rate is positive, or work is queued behind it (stage1_urls_queued_total / redis_queue_length) - Standby when the rate is ~0 with an empty queue - Unknown (+badge-danger) when the stage's counter is not exported The fetch-failure path already repaints card badges as Unknown/danger; it now also flips the four stage health rows to Unknown. Stage 3's hardcoded 'Running' initial badge becomes 'Pending' like the others; the first poll applies the real state. Tests: tests/stage-badges.test.js covers idle->active transitions, queue backlog, missing series, and the wiring. node --test Scraping_project/dashboard/tests/: 210/213 pass; the 3 failures (js-budget, error-runbook, first-run-wizard) pre-exist on main.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #384.
What changed
Scraping_project/dashboard/format-utils.js: new purestageBadgeStates(metrics, rates)helper —runningwhen the stage's per-interval rate is > 0 (or work is queued behind it viastage1_urls_queued_total/ labelledredis_queue_length),standbywhen rate ≈ 0 with an empty queue,unknownwhen the stage's counter series is not exported.Scraping_project/dashboard/app.js: newapplyStageBadges(metrics, rates)called fromupdateDashboard— sets badge text/class on the four Overview stage cards (overview-sN-badge) and drives the four System Health stage rows viasetHealthTile. The fetch-failure path already repaints card badges as Unknown/badge-danger; it now also flips the stage health rows to Unknown.Scraping_project/dashboard/index.html: added ids to the four previously anonymous hardcoded badge spans; Stage 3's hardcoded "Running"/badge-success initial state is now neutral "Pending" until the first poll applies the real state.Scraping_project/dashboard/tests/stage-badges.test.js: 7 tests covering idle→active transitions, queue backlog → running, missing/unavailable metrics → unknown, and the app.js/HTML wiring.Test evidence
node --test Scraping_project/dashboard/tests/: 210/213 pass (was 203/206 on the base commit — the 3 failures in js-budget, error-runbook, and first-run-wizard pre-exist on main and are unrelated).node --checkpasses on both changed JS files.