# Your trace has a gap exactly where the bug is

DevFeed: [Your trace has a gap exactly where the bug is](<https://devfeed.tech/articles/your-trace-has-a-gap-exactly-where-the-bug-is-100770.md>)

Original publisher: [Read original article](<https://ankit-rana.com/logs/69-trace-gap-where-the-bug-is/>)

Author: hello@ankit-rana.com

Published: 2026-10-26T00:00:00Z

Content type: article

Language: en

Sources: [Ankit Rana | Mechanical Sympathy](<https://devfeed.tech/sources/ankit-rana-mechanical-sympathy.md>)

Topics: [tracing](<https://devfeed.tech/topics/tracing.md>), [threadpools](<https://devfeed.tech/topics/threadpools.md>), [Publish-subscribe pattern](<https://devfeed.tech/topics/pubsub.md>), [out-of-process](<https://devfeed.tech/topics/out-of-process.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [bug](<https://devfeed.tech/tags/bug.md>), [callback](<https://devfeed.tech/tags/callback.md>), [client](<https://devfeed.tech/tags/client.md>), [context](<https://devfeed.tech/tags/context.md>), [context-propagation](<https://devfeed.tech/tags/context-propagation.md>), [debug](<https://devfeed.tech/tags/debug.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [distributed-systems](<https://devfeed.tech/tags/distributed-systems.md>), [distributed-tracing](<https://devfeed.tech/tags/distributed-tracing.md>), [error](<https://devfeed.tech/tags/error.md>), [executor](<https://devfeed.tech/tags/executor.md>), [gap](<https://devfeed.tech/tags/gap.md>), [garbage-collection](<https://devfeed.tech/tags/garbage-collection.md>), [latency](<https://devfeed.tech/tags/latency.md>), [message-queues](<https://devfeed.tech/tags/message-queues.md>), [observability](<https://devfeed.tech/tags/observability.md>), [opentelemetry](<https://devfeed.tech/tags/opentelemetry.md>), [queues](<https://devfeed.tech/tags/queues.md>), [retries](<https://devfeed.tech/tags/retries.md>), [thread](<https://devfeed.tech/tags/thread.md>), [thread-pool](<https://devfeed.tech/tags/thread-pool.md>), [trace](<https://devfeed.tech/tags/trace.md>), [tracing](<https://devfeed.tech/tags/tracing.md>)

## AI overview

A long parent span with much shorter child spans can mean work lost its trace context at an execution boundary, leaving missing work invisible rather than producing an error. The excerpt explains that thread-local context does not cross executor threads unless captured and restored (for example, by wrapping the executor); queue context must be injected into and extracted from message headers, with links recommended for asynchronous causality; and callbacks or reactive schedulers need context bridging. Library retries can hide multiple attempts inside one span, so instrumenting attempts separately can reveal failures and retry counts. Similar gaps can come from stop-the-world GC pauses or connection-pool waits, which can be distinguished by correlating pauses or instrumenting acquisition. To investigate, compare child durations with the parent and inspect what ran during the unaccounted interval. Head sampling decides at trace start and can miss incidents; tail sampling can retain slow or failed traces but requires buffering and routing all trace spans to one collector.

## Source excerpt

Distributed tracing works by passing a context object along the call path, and any boundary that does not carry it forward silently ends the trace. Thread pool handoffs, message queues, callbacks and library-managed retries are the usual places, which is unfortunate because those are also where the latency and the bugs live. A gap does not appear as an error, it appears as a span that seems to take four seconds while its children are simply absent.