Move query completion logging into onQueryResponse - #1377
Conversation
Previously all queries dispatched in a fetch tick were batched into a single "Finished querying" log keyed by partition. Log per query instead, and include the count of events that triggered contract registration.
Reuse the itemsWithContractRegister count already computed there instead of re-scanning parsedQueueItems in fetchChain.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesQuery Completion Logging
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/envio/src/ChainFetching.res (1)
207-215: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winVerify the rollback path still emits a per-query trace.
This log only runs in the
NoReorgbranch, so queries that detect a reorg no longer appear in the new per-query completion telemetry. If that’s unintended, move the trace before the rollback switch or duplicate it in the reorg branch.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/src/ChainFetching.res` around lines 207 - 215, The per-query completion trace in ChainFetching.res only runs in the NoReorg path, so reorg-detecting queries miss the telemetry. Update the query flow around the Logging.trace call in the query completion logic so that every query emits this trace, either by moving it before the rollback branch or by duplicating the same trace in the reorg path, keeping the existing fields like chainId, partitionId, fromBlock, and toBlock consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/envio/src/ChainFetching.res`:
- Around line 207-215: The per-query completion trace in ChainFetching.res only
runs in the NoReorg path, so reorg-detecting queries miss the telemetry. Update
the query flow around the Logging.trace call in the query completion logic so
that every query emits this trace, either by moving it before the rollback
branch or by duplicating the same trace in the reorg path, keeping the existing
fields like chainId, partitionId, fromBlock, and toBlock consistent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bb7d3989-843f-49f0-a30f-856ddaf4223f
📒 Files selected for processing (1)
packages/envio/src/ChainFetching.res
CodeRabbit flagged that the "Finished querying" trace only fired on the no-reorg path, silently dropping telemetry for queries that trigger a reorg rollback. Compute the log before the reorg branch so every non-stale query response is captured.
Summary
Refactored query completion logging to be emitted per-query within
onQueryResponseinstead of being accumulated and emitted once per tick infetchChain. This provides more granular visibility into individual query completions and simplifies the control flow.Key Changes
fetchChainintoonQueryResponse, now logged immediately after each query completes with its specific resultsfetchChainthat trackeddispatchedCount,fetchedByPartition, andfetchedCountchainId,partitionId,fromBlock,toBlock,numEvents, andnumContractRegisterEventsImplementation Details
The logging now captures partition-specific metrics directly from the query response, eliminating the need to aggregate results across multiple queries dispatched in a single tick. This makes the log output more immediate and easier to correlate with specific query executions.
https://claude.ai/code/session_01HLzAxQms9kMmEhSaJ2YJ5d
Summary by CodeRabbit