feat(cli): add --hold-secs to replay so Grafana sees the demo (closes #422)#423
Merged
feat(cli): add --hold-secs to replay so Grafana sees the demo (closes #422)#423
Conversation
…422) `replay` exits in well under one Prometheus scrape interval, so the Grafana dashboard never sees any replay data — Queue depth, Profit predicted, Executor simulations/min all show "No data" or zeros even when the bot identified $39k+ of liquidatable opportunities. Add a `--hold-secs <N>` flag (default 0, current behaviour) that keeps the metrics exporter open for N seconds after the one-shot pipeline emits. Also start the metrics exporter at the top of the replay path so the held-open window actually serves `/metrics` — previously only the `listen` path installed the exporter. Local validation against block 91323624: curl http://127.0.0.1:9091/metrics | grep profit_usd_cents_sum charon_executor_profit_usd_cents_sum{chain="bnb"} 3952448 Matches the four JSON records' `predicted_net_profit_usd_cents` sum (\$39,524.48). Default-zero hold preserves CI / smoke-test behaviour.
…ow-up) The Profit (predicted/realised) stat panels used `sum(increase(...)[$__range])) / 100` which only fires when Prometheus sees a 0->bump transition. `replay` bumps the counter once in <1s, well below Prometheus's 15s scrape interval, so the panel always showed 0 even when the bot identified $39k+ of opportunities. Switch the two profit-stat panels to the gauge form `sum(charon_executor_*_profit_usd_cents_sum) / 100` so the dashboard shows the cumulative total since the bot started. For replay this is the replay's emitted profit; for production listen runs it is the running total since the latest bot start, which is the more useful number anyway (operators read realised profit per range from the heatmap below). Legend updated to 'cumulative' to match the new semantic. Bumped dashboard version so provisioning re-imports. Pairs with #422's --hold-secs flag — together they let the dashboard serve a useful demo number against any pinned-block fork run.
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
`replay` exits in well under one Prometheus scrape interval, so the Grafana dashboard never sees any replay data — Queue depth, Profit predicted, Executor simulations/min all show "No data" / zeros even when the bot identifies $39k+ of liquidatable opportunities.
Fix
Test plan
Cosmetic UX, no risk to production paths.