backend observability#219
Merged
Merged
Conversation
Cedarich
approved these changes
Jun 28, 2026
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 #132
Improve backend observability for campaign traffic, wallet auth flows, and payment reconciliation by adding request tracing, correlation IDs, structured JSON logging, and slow-call detection across HTTP handlers and background workers.
Changes
Core observability infrastructure
ObservabilityModulewith:CorrelationIdMiddleware— reads or generatesX-Correlation-ID, echoes it on responsesRequestContextService—AsyncLocalStorage-based context propagation (correlationId,traceId,workerRunId,workerName)StructuredLogger— JSON logs with automatic context fieldsLoggingInterceptor— structured HTTP request start/complete/error logsHttpExceptionFilter— error responses includecorrelationIdandtraceIdtraceAsync()utility — spans for network/database calls withspan.slowwarningsDomain instrumentation
invoice.createdevent on invoice creationhorizon:<txHash>), traced Horizon/Soroban network callssoroban:<eventId>), traced RPCgetEventscallsDatabase & network slow-call tracing
db.query.slowwhen queries exceed thresholdspan.slowfor Horizon and Soroban RPC calls above thresholdSLOW_DB_THRESHOLD_MS(default 200) andSLOW_NETWORK_THRESHOLD_MS(default 500)Frontend propagation
apiClientsendsX-Correlation-IDon every requestAcceptance criteria
correlationId,traceId, andworkerRunIddb.query.slowandspan.sloweventsTest plan
npm run buildpassesnpm test— 19 suites, 133 tests)RequestContextServiceandtraceAsynccorrelationIdwith response headerinvoice.createdstructured logspan.slow/db.query.slowwarnings