feat: query logging, retention policy, health checks, and service unit tests#160
Merged
Kevin737866 merged 5 commits intoJun 1, 2026
Conversation
Log every database query at debug level (sql, paramCount, durationMs, rowCount) and log failures at error level so timing data is available for debugging without waiting for the slow-query threshold. closes Kevin737866#130 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix archiveAndDelete to loop in 1000-record batches and delete only the archived IDs instead of all rows at once, preventing data loss when more than 1000 rows need archiving. Add deleteOldMetrics for tables without an archive (network_metrics, asset_metrics, account_metrics). Wire up all seven RETENTION_PERIODS entries in applyRetention. closes Kevin737866#140 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add GET /health/live (always 200 while process is up) and GET /health/ready (503 when either Redis or PostgreSQL is unreachable) for Kubernetes-style probe support. The existing /health endpoint is unchanged and continues to return the full HealthCheckResult. closes Kevin737866#129 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…entionService StellarService – verify Horizon SDK method chains (ledgers, transactions, operations, accounts, streaming) and testConnection error handling. IndexerService – verify constructor, getStatus shape, stop idempotency, and resetCircuitBreaker using fully mocked dependencies. RetentionService – verify RETENTION_PERIODS, compliance report, retention status parsing, lifecycle (start/stop), and that all seven table categories are processed during applyRetention. closes Kevin737866#141 Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
DatabaseConnection.query()so every query is traceable at debug level.network_metrics,asset_metrics, andaccount_metricsusing all sevenRETENTION_PERIODSconstants.GET /health/live(liveness probe, always 200) andGET /health/ready(readiness probe, 503 when Redis or PostgreSQL is unreachable) alongside the existing/healthendpoint.StellarService(SDK method chains, streaming, error handling),IndexerService(lifecycle, status shape, circuit-breaker reset), andRetentionService(compliance report, retention status, start/stop, all seven table categories).Closes #130
Closes #140
Closes #129
Closes #141
Test plan
GET /health/livereturns200 { status: "alive" }while server is runningGET /health/readyreturns503when Redis or Postgres is down,200when both are upLOG_LEVEL=debugpnpm testinpackages/indexer— all three new test files pass🤖 Generated with Claude Code