Skip to content

[Backend] Background indexer/worker logs carry no correlation id - only HTTP requests get one #845

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Labels: enhancement, backend, Stellar Wave, devops

Only HTTP requests get a correlation id, so worker logs from one poll cycle have nothing tying them together.

logger.ts:4-18 pulls requestId into log lines from the AsyncLocalStorage store that's set on HTTP requests. The Soroban worker and indexerService run outside any requestContext, so a poll batch and its per-event error logs carry no shared id. When something fails you can't tell which logs belong to the same poll cycle or a particular admin replay.

What the fix has to hold to

  • all logs from one poll/replay cycle share a single id
  • the id is available on error logs and handed back from the replay endpoint

Done when

  • each poll/replay batch wrapped in requestContext.run({ requestId: <batchId> }, ...) so its logs share an id
  • batch/correlation id included in indexer error logs and in the replay endpoint response
  • field documented in the logging section
  • tests + CI green

Where to start
backend/src/workers/soroban-event-worker.ts and backend/src/services/indexerService.ts for wrapping the batches, backend/src/logger.ts for the field. Swapping the log transport/format library is out of scope. Small change, reuses the existing AsyncLocalStorage plumbing.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Stellar WaveIssues in the Stellar wave programbackendBackend related tasksdevopsInfrastructure and CI/CDenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions