Skip to content

feat: Stellar submission failures metrics#670

Merged
tirumerla merged 2 commits into
mainfrom
stellar-submisison-metrics
Mar 13, 2026
Merged

feat: Stellar submission failures metrics#670
tirumerla merged 2 commits into
mainfrom
stellar-submisison-metrics

Conversation

@zeljkoX

@zeljkoX zeljkoX commented Feb 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Track stellar submission failures and their reasons

Testing Process

Checklist

  • Add a reference to related issues in the PR description.
  • Add unit tests if applicable.

Note

If you are using Relayer in your stack, consider adding your team or organization to our list of Relayer Users in the Wild!

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced error messages for failed Stellar transaction submissions with decoded status details.
    • Improved tracking of submission failures with categorized status and result information.
  • Tests

    • Added coverage for submission failure scenarios and error decoding.

@zeljkoX zeljkoX requested a review from a team as a code owner February 20, 2026 14:45
@coderabbitai

coderabbitai Bot commented Feb 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9b6c5b0a-cc40-4ab4-8922-ee763cc52805

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR enhances Stellar transaction submission error handling with XDR result code decoding and improved metrics tracking. A new utility function decodes transaction error XDR, the submission flow captures decoded error codes with detailed labeling, and a new Prometheus metric tracks submission failures by status and result code.

Changes

Cohort / File(s) Summary
Stellar Submission Error Handling
src/domain/transaction/stellar/submit.rs
Upgraded error handling to decode XDR error results via new utility, convert provider errors to TransactionError with metrics, and classify failures on TRY_AGAIN_LATER, ERROR, and unknown status paths. Added test validating ERROR path decoding logic.
XDR Decoding Utility
src/domain/transaction/stellar/utils.rs
Added public function decode_tx_result_code to decode base64-encoded TransactionResult XDR into human-readable variant names (e.g., "TxBadSeq"). Includes tests for successful decoding and invalid input handling.
Metrics Infrastructure
src/metrics/mod.rs
Introduced new CounterVec metric STELLAR_SUBMISSION_FAILURES to track submission failures with labels submit_status and result_code, registered to global Prometheus registry.

Sequence Diagram

sequenceDiagram
    participant Client
    participant SubmissionHandler as Submit Handler
    participant Provider as Stellar Provider
    participant Decoder as XDR Decoder
    participant Metrics as Metrics Registry

    Client->>SubmissionHandler: Submit transaction
    SubmissionHandler->>Provider: Call submit_transaction
    
    alt Provider Error
        Provider-->>SubmissionHandler: Error response
        SubmissionHandler->>Metrics: Increment STELLAR_SUBMISSION_FAILURES<br/>[provider_error]
        SubmissionHandler-->>Client: TransactionError
    else TRY_AGAIN_LATER
        Provider-->>SubmissionHandler: TRY_AGAIN_LATER status
        SubmissionHandler->>Metrics: Increment STELLAR_SUBMISSION_FAILURES<br/>[try_again_later, n/a]
        SubmissionHandler-->>Client: Failure result
    else ERROR with XDR
        Provider-->>SubmissionHandler: ERROR + error_result_xdr
        SubmissionHandler->>Decoder: decode_tx_result_code(xdr)
        Decoder-->>SubmissionHandler: result_code (e.g., "TxBadSeq")
        SubmissionHandler->>Metrics: Increment STELLAR_SUBMISSION_FAILURES<br/>[error, result_code]
        SubmissionHandler-->>Client: Detailed error with code
    else Unknown Status
        Provider-->>SubmissionHandler: Unknown status
        SubmissionHandler->>Metrics: Increment STELLAR_SUBMISSION_FAILURES<br/>[unknown_status, n/a]
        SubmissionHandler-->>Client: Unknown error
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

cla: allowlist

Suggested reviewers

  • dylankilkenny
  • collins-w

Poem

🐰 Hops through the stellar night
XDR codes now decoded bright
Metrics dance with labels clean
Error paths, now foreseen
Failures tracked with precision's light

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description follows the template structure but lacks critical details: the Testing Process section is empty, checklist items are unchecked, and no related issues are referenced. Complete the Testing Process section describing how the changes were validated, reference any related issues, and document whether unit tests were added to verify the new metrics functionality.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding metrics for Stellar submission failures with decoded result codes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch stellar-submisison-metrics
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can customize the high-level summary generated by CodeRabbit.

Configure the reviews.high_level_summary_instructions setting to provide custom instructions for generating the high-level summary.

@codecov

codecov Bot commented Feb 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.87755% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.97%. Comparing base (f720040) to head (f86495f).

Files with missing lines Patch % Lines
src/domain/transaction/stellar/submit.rs 83.33% 3 Missing ⚠️
Additional details and impacted files
Flag Coverage Δ
ai 0.26% <0.00%> (-0.01%) ⬇️
dev 90.95% <93.87%> (-0.01%) ⬇️
properties 0.01% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@@            Coverage Diff             @@
##             main     #670      +/-   ##
==========================================
- Coverage   90.97%   90.97%   -0.01%     
==========================================
  Files         288      288              
  Lines      118548   118596      +48     
==========================================
+ Hits       107852   107887      +35     
- Misses      10696    10709      +13     
Files with missing lines Coverage Δ
src/domain/transaction/stellar/utils.rs 90.43% <100.00%> (+0.13%) ⬆️
src/metrics/mod.rs 89.53% <ø> (ø)
src/domain/transaction/stellar/submit.rs 94.85% <83.33%> (-0.23%) ⬇️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@NicoMolinaOZ NicoMolinaOZ left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tirumerla tirumerla left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tirumerla tirumerla merged commit fabe2f3 into main Mar 13, 2026
26 checks passed
@tirumerla tirumerla deleted the stellar-submisison-metrics branch March 13, 2026 04:20
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants