fix: detect stale chain_status in indexer status endpoint#5
Merged
Conversation
Previously /api/v1/metrics/indexer/status reported healthy=true even when the underlying RPC was bootstrapping and the indexer was hours behind real chain tip. Root cause: latest_block comes from chain_status (set by the indexer from RPC.GetLatestBlock), so when the RPC reports a lagging tip, current_block and latest_block move in lockstep and blocks_behind stays at 0. Adds a freshness check on chain_status.last_updated. The syncer only rewrites that timestamp after catching up to the RPC tip, so a stale value reliably signals a stuck or backfilling indexer. EVM threshold 5m, P-Chain 15m. P-Chain last_sync now reflects indexer activity (chain_status.last_updated) instead of the latest block timestamp. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Previously /api/v1/metrics/indexer/status reported healthy=true even when the underlying RPC was bootstrapping and the indexer was hours behind real chain tip. Root cause: latest_block comes from chain_status (set by the indexer from RPC.GetLatestBlock), so when the RPC reports a lagging tip, current_block and latest_block move in lockstep and blocks_behind stays at 0.
Adds a freshness check on chain_status.last_updated. The syncer only rewrites that timestamp after catching up to the RPC tip, so a stale value reliably signals a stuck or backfilling indexer. EVM threshold 5m, P-Chain 15m. P-Chain last_sync now reflects indexer activity (chain_status.last_updated) instead of the latest block timestamp.