Conversation
…le (closes #328) `crates/charon-scanner/src/listener.rs::publish` emitted the counter via a raw `metrics::counter!("charon_blocks_received_total", ...)` string literal, bypassing `charon_metrics::names::*`. The dashboard and `chain` template variable both queried `charon_scanner_blocks_total` (bumped per pipeline tick from `record_block_scanned`), so the listener counter was a write-only metric that consumed cardinality without ever appearing on a panel — and worse, the chain template variable wouldn't populate until the pipeline's first tick landed, leaving fresh dashboard imports stuck on "No Data" for several minutes after a cold boot. Add `names::LISTENER_BLOCKS_RECEIVED_TOTAL = "charon_listener_blocks_received_total"` plus a typed `record_block_received(chain)` helper, route the listener call site through it, register it in `describe_all`, and swap the dashboard's `chain` template variable to query the listener counter so panels populate the moment the websocket subscription delivers `new_heads` rather than waiting for the first pipeline tick. `describe_counter!` for `SCANNER_BLOCKS_TOTAL` updated to clarify "per pipeline tick" so the two counters can't drift in operator mental models again.
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.
Summary
names::LISTENER_BLOCKS_RECEIVED_TOTALconstant +record_block_received(chain)helper.listener.rs::publishnow calls the typed helper instead of a raw string literal.chaintemplate variable swapped tocharon_listener_blocks_received_totalso the dropdown populates the moment the WS subscription firesnew_heads, not after the first pipeline tick.SCANNER_BLOCKS_TOTALdescription to "per pipeline tick" so the two counters cannot drift in operator mental models again.Why
The old raw-string
charon_blocks_received_totalwas never queried by any dashboard or alert. The dashboard'schaintemplate var queriedcharon_scanner_blocks_total(bumped per pipeline tick), so fresh imports stayed on "No Data" for several minutes after cold boot until the first pipeline tick landed. Closes #328.Test plan
cargo build --workspacecleancargo test --workspace --lib56/56charon_blocks_received_totalname (rg)