Why your distributed traces are incomplete: missing spans, timeouts, sampling and context propagation
Orphan spans, missing root spans and services that never show up almost always have a handful of causes. This guide shows how to find them, verify them and fix them with OpenTelemetry.
Summary
- Incomplete traces almost always come from one of five causes: broken context propagation, missing instrumentation, exporter and collector drops, inconsistent sampling, or clock skew.
- Each cause leaves a recognisable symptom, such as orphan spans, a missing root span, unexplained gaps or a service that never appears, which tells you where to look first.
- Forwarding traceparent everywhere, aligning propagators and samplers across services, sizing the BatchSpanProcessor and routing spans by trace ID before tail sampling fix most cases.
Incomplete traces are one of the most common complaints after a team rolls out distributed tracing: a request clearly went through five services, but the trace view shows two, the root span is missing, or a span starts out of nowhere with a parent nobody can find. The tracing backend is rarely the culprit. In almost every case, spans were never created, never linked to the right parent, dropped on the way, or deliberately sampled away.
This guide groups the causes into five families: context propagation, missing instrumentation, timeouts and exporter drops, sampling, and clock skew. For each, it explains how to verify the cause and how to fix it with OpenTelemetry. At the end you get a symptom table and a trace completeness checklist you can copy into your runbook.
Symptoms: what incomplete traces look like
Before changing configuration, name the symptom precisely. Each one points to a different part of the pipeline.
- Orphan spans. A span references a parent span ID that does not exist in the trace. The parent was either never exported, dropped, or sampled out on a different service.
- Broken or split traces. One user request produces two or more traces with different trace IDs. A hop in the middle did not forward the context, so the next service started a new trace.
- Missing root span. The trace has children but no entry span. Typical causes are a frontend or gateway that is not instrumented, a root span that was never ended, or a process that exited before exporting.
- Gaps between spans. A parent span takes 800 ms, but its children only account for 200 ms. Something happened that nobody instrumented: a database driver, a cache client, a lock or CPU-bound code.
- "Service X never appears." A service is known to be in the call path but never shows up in any trace. Either it is not instrumented, it exports to the wrong endpoint, or its sampler drops everything.
- Children before parents. A child span appears to start before its parent or extends beyond it. This is usually clock skew between hosts, not a real ordering problem.
Context propagation failures: the most common cause
Context propagation is how the trace ID and parent span ID travel from one service to the next. In OpenTelemetry the default is W3C Trace Context: the traceparent header carries version, trace ID, parent span ID and trace flags (including the sampled flag), and tracestate carries vendor-specific data. If any hop drops these headers, the next service starts a new trace and you get split traces.
Proxies, API gateways and load balancers
Reverse proxies, API gateways, service meshes and load balancers sit between your services and often rebuild requests. Some strip unknown headers, some forward only an allow-list, and some generate their own trace headers in a different format. Check every intermediate component: either it should forward traceparent and tracestate unchanged, or it should be instrumented itself and continue the trace as a proper hop.
Message queues and async processing
HTTP headers do not survive a trip through Kafka, RabbitMQ, SQS or a job queue on their own. The producer has to inject the context into message headers or attributes, and the consumer has to extract it before starting its span. Instrumentation libraries for common clients do this; hand-written producers and consumers usually do not. For batch consumers that process many messages at once, span links are often the better model than a single parent.
Thread pools, callbacks and async boundaries
Inside a process, the active context is stored in thread-local or async-local storage. When work is handed to a thread pool, an executor, a callback or a reactive pipeline, the context can get lost, so the new span becomes a root span or attaches to the wrong parent. Wrap executors with the context-aware helpers your OpenTelemetry SDK provides, or capture the current context explicitly and make it current inside the task.
Mixed propagators
If one service only speaks B3 and the next only W3C Trace Context, neither understands the other's headers. Set the same propagators everywhere via OTEL_PROPAGATORS. The default is tracecontext,baggage; during a migration you can accept both formats:
# every service, during a B3 to W3C migration (example)
OTEL_PROPAGATORS=tracecontext,baggage,b3multi
Valid values include tracecontext, baggage, b3 (single header), b3multi (multiple headers), xray and none. Once all services understand W3C, remove B3 again.
How to verify: log or capture the incoming headers at the service where the trace breaks. If traceparent is missing or contains a different trace ID than the caller's span, the hop before it is the problem.
Missing instrumentation and spans that are never ended
Gaps and missing services are often simply uninstrumented code. Auto-instrumentation covers popular HTTP servers, clients, database drivers and messaging libraries, but not every library and not every version. Check the supported library list of your language's instrumentation, and add manual spans around the rest: custom RPC clients, legacy SDKs, CPU-heavy functions and long waits on locks or pools.
Manual spans have their own failure mode: a span that is started but never ended is never exported. This happens when an exception skips the end() call or when a span is started in one function and expected to be ended in another. Always end spans in a finally block or use the language's scoped helper:
# Python (example)
with tracer.start_as_current_span("charge-card") as span:
span.set_attribute("payment.provider", "example")
result = client.charge(order)
A missing root span is frequently a never-ended span at the entry point, for example in custom middleware that starts a span before the framework instrumentation does.
Timeouts, exporter drops and collector limits
Even correctly created spans can be lost between your application and your backend.
BatchSpanProcessor queue and export timeouts
The SDK buffers finished spans in the BatchSpanProcessor and exports them in batches. When the queue is full, new spans are dropped. When an export takes longer than the timeout, the batch is lost. The relevant environment variables and their defaults from the OpenTelemetry specification are:
OTEL_BSP_SCHEDULE_DELAY=5000 # ms between exports
OTEL_BSP_EXPORT_TIMEOUT=30000 # ms allowed per export
OTEL_BSP_MAX_QUEUE_SIZE=2048 # spans buffered before dropping
OTEL_BSP_MAX_EXPORT_BATCH_SIZE=512 # must be <= queue size
High-throughput services or bursty traffic can overflow a 2048-span queue. Raise the queue size moderately and make sure the exporter endpoint (usually a local Collector) answers quickly. Most SDKs emit a log line or internal metric when spans are dropped; enable SDK diagnostics and look for it.
Spans ended after shutdown
Short-lived processes such as CLI jobs, serverless functions and batch workers often exit before the last batch is exported. Call shutdown() or force_flush() on the tracer provider before the process ends, and give it enough time to finish. For serverless platforms, use the flush hooks provided by the platform-specific instrumentation.
Collector memory_limiter and backpressure
In the OpenTelemetry Collector, the memory_limiter processor refuses data when memory usage crosses its soft limit (limit_mib minus spike_limit_mib). That protects the Collector from crashing, but refused spans are lost unless the sender retries. Watch the Collector's own refused and dropped metrics, size its memory properly and scale horizontally before limits are hit. Our post on OpenTelemetry Collector production best practices covers queueing, retries and sizing in detail.
Trace sampling: when spans are dropped on purpose
Sampling is the intended way to drop data, but inconsistent trace sampling produces incomplete traces that look like bugs.
Head-based ratio sampling
The traceidratio sampler keeps a fraction of traces based on the trace ID. On its own, each service decides independently, so with different ratios one service may keep a trace that another drops. Use the parent-based variant so downstream services follow the decision of the root:
# same on every service (example ratio)
OTEL_TRACES_SAMPLER=parentbased_traceidratio
OTEL_TRACES_SAMPLER_ARG=0.1
With parentbased_traceidratio, the ratio only applies to root spans; children honour the sampled flag from traceparent. The SDK default is parentbased_always_on.
Parent-based sampling across services
Problems appear when one service ignores the parent: for example, it uses plain traceidratio or always_off, or a gateway in front starts a fresh trace with its own sampler. The result is a trace with holes exactly where that service sits. Audit the sampler settings of every service, including gateways and sidecars.
Tail-based sampling needs complete traces on one instance
The tail_sampling processor decides after it has seen a trace, waiting for decision_wait (default 30s) and keeping up to num_traces traces in memory. If you run several Collector instances behind a normal load balancer, the spans of one trace are spread across instances and each sees only a fragment. Put a first Collector tier in front that routes by trace ID with the load-balancing exporter:
exporters:
load_balancing: # formerly "loadbalancing", still accepted as alias
routing_key: traceID
protocol:
otlp:
tls:
insecure: true
resolver:
dns:
hostname: otel-sampling-tier.observability.svc.cluster.local
port: 4317
Spans that arrive after decision_wait also end up as fragments, so set it longer than your slowest typical trace. The full setup is described in our article on tail-based sampling with the OpenTelemetry Collector.
Clock skew: when spans look out of order
Span timestamps come from the host that created them. If clocks on two hosts differ by 200 ms, a child span can appear to start before its parent or after it ended. The trace is complete, but the waterfall looks broken and duration math between services becomes misleading. Run NTP or chrony on every host and node, monitor clock offset as a metric, and compare durations within one span rather than across hosts when the offset is unknown.
Symptom table: from symptom to fix
| Symptom | Likely cause | How to verify | Fix |
|---|---|---|---|
| One request, several trace IDs | A hop drops traceparent | Log incoming headers at the first service of the second trace | Forward or instrument the proxy, gateway or queue |
| Orphan spans with unknown parent | Parent sampled out, dropped or never ended | Check sampler config and SDK drop logs on the parent service | Use parentbased_* samplers; end spans in finally |
| Missing root span | Entry point uninstrumented or root never exported | Search for the trace ID in gateway or frontend telemetry | Instrument the entry point; flush on shutdown |
| Gaps between spans | Uninstrumented library or CPU-bound code | Compare with a profile or add a temporary manual span | Add instrumentation or manual spans |
| Service never appears | No SDK, wrong endpoint or sampler off | Check exporter endpoint and OTEL_TRACES_SAMPLER | Fix endpoint; align sampler with other services |
| Spans missing under load only | BatchSpanProcessor queue full or Collector refusing | SDK drop counters, Collector refused/dropped metrics | Tune OTEL_BSP_*; scale Collector |
| Fragments after tail sampling | Trace spread across Collector instances | Compare span counts per instance for one trace ID | Route by trace ID with load_balancing |
| Async work detached from request | Context lost at thread pool or callback | Check whether the async span is a new root | Wrap executors; pass context explicitly |
| Child starts before parent | Clock skew between hosts | Compare host clock offset metrics | Enable NTP or chrony everywhere |
Trace completeness checklist
Copy this checklist into your tracing runbook
- Every service sets
service.nameand exports to the intended Collector endpoint OTEL_PROPAGATORSis identical across services (defaulttracecontext,baggage)- Proxies, gateways, meshes and load balancers forward
traceparentandtracestateor are instrumented - Message producers inject context into message headers; consumers extract it
- Thread pools, executors and callbacks propagate the current context
- Auto-instrumentation covers all HTTP, database, cache and messaging clients in use
- Manual spans are ended in
finallyblocks or scoped helpers - Short-lived processes call
force_flush()orshutdown()before exiting OTEL_BSP_MAX_QUEUE_SIZEand export timeout fit peak traffic; SDK drop logs are monitored- Collector
memory_limiteris sized and refused/dropped metrics are alerted on - All services use the same
parentbased_*sampler and ratio - Tail sampling runs behind a
load_balancingexporter withrouting_key: traceID decision_waitis longer than your slowest typical trace- Clock synchronisation runs on every host and node
If OpenTelemetry is still new to your team, start with our introduction What is OpenTelemetry? before working through the list.
How Obseria helps with incomplete traces
Obseria is an OpenTelemetry-native observability platform, so the propagators, samplers and Collector settings described here work unchanged. Distributed tracing in Obseria shows traces together with logs, metrics and exemplars of the same request, which makes gaps and orphan spans easier to spot and explain.
- Obseria Pipeline applies sampling, filtering and PII masking before storage, so sampling rules live in one place instead of in every service.
- Obseria TopoGraph shows the service topology, which makes it visible when a service in the call path never reports spans.
- Obseria Intelligence links slow or failed requests to a likely cause with evidence from traces, logs and deployments.
Check how complete your own traces are with a 14-day free trial of Obseria.