Dashboard DISTINCT counts, equity/freshness panels, structured precursor events (fixes #224)#237
Merged
Merged
Conversation
… precursor events (#224) Addresses the four dashboard + log-pipeline gaps from issue #224. 1. Count panels now use count(DISTINCT event_id) instead of count(*) (Fills, Alerts, Cleanups, Cancel Reasons, Inventory Exits), so at-least-once duplicate uploads no longer inflate metrics. The Cleanups metric additionally filters event='complete' to exclude the new retry-incomplete precursor rows. 2. New dashboard panels: Equity/uPnL/Available trend (consuming cycle_summary.account, live-only), Data Freshness (max(_timestamp)), Rejections & Error Signals, and Stream Health / Reconnects. 3. Precursor eprintln signals now emit structured stdout JSON events in JSON mode so the existing stdout ingest uploads them: cancel-retry failures (recovery.rs, action=maker_cleanup event=retry_incomplete) and reconciliation-snapshot failures (runtime.rs, action=position_reconciliation event=snapshot_failed), both severity=warning. Non-JSON output keeps the human-readable stderr line, matching the existing emit_* pattern. 4. Ingest checkpoint hardening: checkpoints now record file identity (inode + size) and reset to zero on rotation/truncation; a corrupt state file auto-resets instead of wedging --follow at startup; and the checkpoint map is bounded (LRU eviction) so openobserve-uploaded.json no longer grows unbounded. event_id idempotency remains the dedup safety net. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
7606f0d to
981bf83
Compare
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
Closes the four dashboard + log-pipeline gaps in issue #224.
count(DISTINCT event_id)instead ofcount(*), matching the guidance indocs/15-openobserve.md. Daily duplicate uploads on network jitter (at-least-once retry) no longer inflate key metrics. The Cleanups metric also filtersevent='complete'so it is not skewed by the new retry-incomplete precursor rows.Equity / uPnL / Availabletrend (Overview), consumingcycle_summary.account(live runs only;accountis null in paper mode).Data Freshness(Overview) —max(_timestamp)+ event count for the selected run.Rejections & Error Signals(Runs & Events) — order/startup rejections, warning/critical risk notifications, and reconciliation/cleanup precursor failures.Stream Health / Reconnects(Runs & Events) — order-response reconnect lifecycle by phase.eprintln!signals now emit structured stdout JSON events in JSON mode (so the existing stdout ingest uploads them), while keeping the human-readable stderr line for non-JSON output, matching the existingemit_*pattern:recovery.rs,action=maker_cleanup,event=retry_incomplete,severity=warning.runtime.rs,action=position_reconciliation,event=snapshot_failed,severity=warning.--followat startup; and the checkpoint map is bounded via LRU eviction soopenobserve-uploaded.jsonno longer grows unbounded.event_ididempotency remains the dedup safety net. Legacy int-valued state entries are still honored.The
STANDX_ENABLE_LIVE_MAKERlive lock is untouched.Test plan
cargo fmt -- --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test -p standx-cli— all green.python3 -m py_compile scripts/openobserve_dashboard.py scripts/openobserve_ingest.py scripts/test_openobserve_ingest.py.python3 -m unittest test_openobserve_ingest— 7 tests pass, including new coverage for truncation reset, corrupt-state auto-reset, legacy int state, and LRU bounding.build_dashboard()smoke check: JSON-serializable, unique panel ids/layout indices per tab (Overview 13 panels, Runs & Events 7).Fixes #224
🤖 Generated with Claude Code