feat: detect and alert on stuck Soroban transactions - #1123
Open
VeronicDev wants to merge 4 commits into
Open
VeronicDev wants to merge 4 commits into
VeronicDev wants to merge 4 commits into
Conversation
Add stuck-transaction detection, per-operation-type metrics, and an admin endpoint for operators to surface transactions stuck in non-terminal state. - Stuck detection in lifecycle service with configurable maxAgeMs threshold - Scheduled scan every 30s with in-memory metrics aggregation - Metrics: totalStuck, byOperationType, byErrorType, oldestStuckAgeMs - Admin REST: GET /admin/soroban-transactions/stuck, /stuck/metrics, /config - 14 tests covering stuck, recovered, terminal, retryable, and metrics Closes Pulsefy#948 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@VeronicDev 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! 🚀 |
Contributor
|
Kindly fix CI |
- Replace CronExpression.EVERY_30_SECONDS with string literal to fix unused import - Remove unused txYoung variable in test - Fix prettier formatting in controller and lifecycle service - Remove unnecessary type assertion on errorType 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
The CronExpression import was left in the test file after switching to string literal for the @Cron decorator. Also fix prettier formatting in stuck-transaction.types.ts. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Author
|
Kindly merge CI Fixed |
Contributor
|
Kindly resolve conflict |
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 #948 — Detect and Alert on Stuck Soroban Transactions
Adds stuck-transaction detection, per-operation-type metrics, and an admin endpoint for operators to surface transactions stuck in non-terminal state past a configurable ledger window.
Changes
Prisma Model
SorobanTransactionmodel withstatus,operationType,retryableErrorType,retryCount, and ledger sequence trackingLifecycle Service (
soroban-transaction-lifecycle.service.ts)trackTransaction()— registers a new on-chain transactionupdateTransactionState()— updates state; auto-classifies terminal vs retryable errorsdetectStuckTransactions()— scheduled scan (every 30s) finding non-terminal txs exceedingmaxLedgerAge(default 50 ledgers)isRetryable()— public method distinguishingRetryableErrorType(NETWORK_TIMEOUT, RPC_ERROR, etc.) from terminal errors (NOT_AUTHORIZED, PACKAGE_EXPIRED, etc.)lastLedgerSequencewhen available, falls back to time-based estimationMetrics
getStuckMetrics()— returnstotalStuck,byOperationType,byRetryableErrorType,oldestStuckAgeAdmin Endpoints
GET /api/v1/admin/soroban-transactions/stuck?operationType=and?retryableOnly=truefiltersGET /api/v1/admin/soroban-transactions/stuck/metricsGET /api/v1/admin/soroban-transactions/configTests (31 passing)
Closes #948