Indexer improvements: Multi-network, Monitoring, Graceful Shutdown & Replay CLI - #584
Closed
kris-nana wants to merge 3 commits into
Closed
Indexer improvements: Multi-network, Monitoring, Graceful Shutdown & Replay CLI#584kris-nana wants to merge 3 commits into
kris-nana wants to merge 3 commits into
Conversation
…hutdown, and replay CLI This commit implements features for issues AudioBitsStellar#255, AudioBitsStellar#256, AudioBitsStellar#257, and AudioBitsStellar#258: Issue AudioBitsStellar#255: Support concurrent indexing of testnet and mainnet - Created IndexerWorker with independent poll loops per contract+network - Network failures are isolated and don't affect other networks - Separate cursor management for each contract+network pair Issue AudioBitsStellar#256: Add CLI to replay/reindex a specific ledger range - Created reindex CLI tool for debugging missed events - Safe: does not mutate live production cursor - Supports dry-run mode for read-only validation - Idempotent event upsertion Issue AudioBitsStellar#257: Monitor Soroban RPC provider quota and cost - Added Prometheus metrics for RPC call counts and latency - Instrumented SorobanService.withBackoff() to track all calls - Metrics exposed by network, method, and status - Documented expected monthly call volume in ADR Issue AudioBitsStellar#258: Graceful shutdown for indexer worker - SIGTERM/SIGINT handlers stop accepting new batches - In-flight batches complete before exit - Cursor only advanced after batch fully persisted - No partial writes or cursor corruption Changes: - src/workers/IndexerWorker.ts: Core indexer worker implementation - src/cli/reindex.ts: Replay/reindex CLI tool - docs/adrs/010-indexer-architecture.md: Architecture decision record - src/services/MetricsService.ts: Added RPC metrics - src/services/Soroban/SorobanService.ts: Instrumented for metrics - .env.example: Added indexer configuration variables - package.json: Added worker:indexer and cli:reindex scripts - src/__tests__/IndexerWorker.test.ts: Worker tests - src/__tests__/ReindexCLI.test.ts: CLI tests
|
@kris-nana Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Added INDEXER_GUIDE.md covering: - Quick start guide - Feature documentation for all 4 issues - Database schema reference - Troubleshooting common issues - Performance tuning guidelines - Monitoring and alerting setup - Deployment examples (Docker, Kubernetes) - FAQ section
Contributor
Author
|
Closing this PR. The implementation will be added to the existing plan PR #583 instead. |
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
This PR implements comprehensive improvements to the AudioBlock indexer subsystem, addressing four related issues that enhance reliability, observability, and debuggability.
Closes #255, Closes #256, Closes #257, Closes #258
What's Changed
1. Multi-Network Support (#255)
Implementation:
2. Replay/Reindex CLI (#256)
Usage:
3. RPC Monitoring (#257)
Metrics:
soroban_rpc_calls_total{network, method, status}soroban_rpc_latency_seconds{network, method}4. Graceful Shutdown (#258)
Behavior:
Files Changed
New Files
src/workers/IndexerWorker.ts- Core indexer worker (300+ lines)src/cli/reindex.ts- Replay/reindex CLI tool (250+ lines)docs/adrs/010-indexer-architecture.md- Architecture decision recordsrc/__tests__/IndexerWorker.test.ts- Worker testssrc/__tests__/ReindexCLI.test.ts- CLI testsModified Files
src/services/MetricsService.ts- Added RPC metricssrc/services/Soroban/SorobanService.ts- Instrumented for metrics.env.example- Added indexer configurationpackage.json- Addedworker:indexerandcli:reindexscriptsConfiguration
New environment variables:
Running the Indexer
Testing
Architecture
Deployment Checklist
Notes
kris-nanaaccount ✅Breaking Changes
None. This is additive functionality.
Next Steps
After merge: