Repository navigation
feat(backend): SEP-0001 retry with backoff; Payment Processor Telemetry sanitization, health and retries - #1605
Open
Elizabethxxx wants to merge 1 commit into
Conversation
…ized telemetry, health and retries to Payment Processor Retry transient SEP-0001 merchant lookups with full-jitter exponential backoff and answer 503 with Retry-After when they stay down. Route all payment processor metrics through sanitising, allow-listed recorders, add rolling-window health, alert series and rules, and retry idempotent status and verification reads.
|
@Elizabethxxx is attempting to deploy a commit to the Emmanuel's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Elizabethxxx 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! 🚀 |
This branch has not been deployed
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
#1459 SEP-0001 Stellar Info Generator: retry with exponential backoff
GET /.well-known/stellar.tomlis the merchant lookup. It now goes throughfetchMerchantForStellarToml()(src/lib/sep0001-retry.js):random(0, min(max, base * 2^n));SEP0001_RETRY_MAX_ATTEMPTS/_BASE_DELAY_MS/_MAX_DELAY_MS, defaults 3 / 100 / 1000, clamped to at most 5 attempts and 5 s.Retry-After: 5instead of 500, so wallets retry rather than treating the domain as having no stellar.toml;Cache-Control: no-store;sep0001_merchant_lookup_retries_total{result}on/metrics.src/lib/sep0001-retry.test.js, newsrc/routes/sep0001.test.js(recover, 503, 500, 404, 400, no error-text leak), plus the app-level cases in the integration suite.SEP0001_GENERATOR_GUIDE.md.#1477 Payment Processor Telemetry: payload sanitization and strict validation
routes/payments.jsandservices/paymentService.jspreviously putreq.body.assetstraight into Prometheus labels, so a client could create a new series per request (unbounded memory here and in Prometheus) or inject text into dashboards.src/lib/payment-processor-telemetry.js:outcome/stage/operationare checked against fixed allow-lists;assetis normalised to^[A-Z0-9]{1,12}$(nativebecomesXLM; malformed codes becomeinvalid; missing becomesunknown);PAYMENT_PROCESSOR_TELEMETRY_MAX_ASSET_LABELS(default 50), with overflow recorded asother;payment_processor_telemetry_rejected_total{metric,reason}and log one warning. Recorders never throw.src/lib/payment-processor-telemetry.test.js(sanitizer table, cardinality cap under a 500-asset flood, every rejection path, a recorder that must not throw).#1478 Payment Processor Telemetry: Prometheus alert metrics and health
payment_processor_health_stateand the four ratio gauges.GET /health/payment-processor(503 only when unhealthy).GET /healthlistsservices.payment_processorfor information only. The body holds counts and ratios only.docs/alerts/payment-processor.rules.yml.#1479 Payment Processor Telemetry: retry with exponential backoff
status_lookup,verify_lookup, in both the route and the service) is retried throughretryProcessorRead()(src/lib/payment-processor-retry.js):PAYMENT_PROCESSOR_RETRY_*, defaults 3 / 50 / 500, clamped to at most 5 attempts and 3 s.{ data, error }comes back unchanged, so response codes are unchanged.payment_processor_retries_total{operation,result}; exhausted retries degrade health.src/lib/backoff-retry.js(retryWithBackoff,retrySupabaseRead) is also used by SEP-0001. It reuses the existingisRetryableSessionErrorclassifier andcomputeBackoffDelay.src/lib/payment-processor-retry.test.js,src/lib/backoff-retry.test.js.Test output
Security notes
no-store, so a CDN cannot cache a failure for the hour that successful responses are cached.Notes
Retry-After(was 500) when a transient lookup outage outlasts the retries.invalid, overflow becomesother; payloads with unknown outcomes are dropped and counted as rejected.payment-processor-metrics.jsexports and series names are unchanged, and the existing metrics, e2e and SEP-0001 tests keep their expectations. No existing tests or fixtures were changed.closes #1459
closes #1477
closes #1478
closes #1479