Repository navigation
fix: give each BullMQ stalled check a trace of its own (v0.1.3) - #4
Merged
Merged
Conversation
BullMQ's Worker starts its stalled-check loop inside the startStalledCheckTimer span, so every moveStalledJobsToWait (every 30 s per queue) and its redis call joined that one trace for the life of the process. In Backbone production each such trace reached Tempo's 5 MB per-trace limit after about a day and a half, and Tempo then refused its spans (trace_too_large). The BullMQ adapter now starts moveStalledJobsToWait on the root context unless BullMQ passes an explicit parent. Every other operation, and a job's propagated parent, is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
BullMQ's
Worker.startStalledCheckTimerstarts the stalled-check loop inside its own span and returns without awaiting it. The loop keeps that span's context, so everymoveStalledJobsToWait(every 30 s, per queue) and itsevalshabecame a child of onestartStalledCheckTimertrace for the life of the process.In Backbone production one such trace held 9,163 spans over about a day and a half (2026-10-18 21:28 → 2026-10-20 11:38 UTC), then crossed Tempo's 5 MB per-trace limit. Since then Tempo refuses its spans at a steady 720/h (
tempo_discarded_spans_total{reason="trace_too_large"}), which fires the platform'sIngestionRejectedalert.The BullMQ adapter is now wrapped (
src/bullmq-loops.ts):moveStalledJobsToWaitstarts on the root context, so each check is a small trace of its own with its Redis call inside it. Every other operation, and a job's propagated parent (an explicit context from BullMQ), is unchanged. Version 0.1.3.Tests
src/__tests__/bullmq-loops.test.tsdrives BullMQ's own exportedtracehelper with the realBullMQOteladapter, in the same shape asstartStalledCheckTimer. Without the fix the three checks share one trace (fails); with it each has its own, and the Redis call stays inside it.pnpm typecheck,pnpm test(981 passed),pnpm buildwithdist/committed.After merge
Tag
v0.1.3, then bump Backbone's pin.🤖 Generated with Claude Code