Each service stamps spans with its own wall clock. Even tens of milliseconds of NTP drift can flip child versus parent ordering. Backends clamp negative durations and rely on parent-span ids for the tree.
Imagine two friends watching a relay race from different stadiums, each timing the runners with their own watch. If their watches disagree by half a second, the friend at the second stadium might record the second runner starting before the first finished, even though they did not. The race tree is still right (everyone agrees who handed off to whom), but the times look wrong. Fix the watches with NTP, and trust the handoff record over the watches when they disagree.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Clock skew is one of those topics that looks like a bug but is actually a property of distributed systems. Every machine in your fleet has its own clock, those clocks drift relative to each other, and NTP or chrony keeps them close but never identical. Tracing across services means stitching together timestamps from different clocks, and when those clocks disagree, the trace shows artifacts: a child span appears to start before its parent, or a span has a negative duration.
This deep dive walks through why the artifacts happen, what OpenTelemetry's design does to make the trace usable anyway (parent_span_id is the load-bearing piece), how backends cope at render time, the operational discipline that keeps the artifacts small and rare, and when you would actually need a hardware clock instead of NTP.
Mental model: timestamps lie a little; ids do not. Order the tree by parent_span_id, clamp negative durations at render, alert on host-clock offset, and accept tiny negative durations as a known property of distributed time.
Why timestamps disagree across services
The root cause is simple and physical.
Every process uses its local wall clock
When a span starts, the SDK records the start time as 'whatever the operating system's wall clock says right now'. The OS gets this from the hardware clock, periodically corrected by NTP or chrony. The corrected value is close to UTC but not exact.
Cross-machine clocks differ
Machines A and B do not share a clock. Each has its own hardware oscillator, its own NTP daemon, and its own correction history. At any given moment, A's wall clock and B's wall clock might differ by a few milliseconds.
The OS clock is not monotonic across NTP adjustments
NTP can step the clock backward when the local clock is too far ahead of true time. The step is instantaneous. If a span on machine B starts before the step and ends after the step, the recorded end time can be earlier than the recorded start time, producing a negative duration without any physical violation of causality.
What 'normal' looks like
A healthy cluster with chrony or systemd-timesyncd typically holds skew under 10 to 50ms. Cloud VMs across the same region usually hit 1 to 5ms. Cross-region or cross-cloud traces can see 50 to 200ms skew. None of these are bugs; they are operating points.
What 'broken' looks like
Skew over 200ms across hosts in the same datacenter indicates NTP failure: the daemon is dead, the upstream server is unreachable, or the host's hardware clock has a fault. The downstream effects are wider than just traces; security tokens, distributed locks, and log ordering can all break.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
Real products, models, and research that use this idea.
- AWS, GCP, and Azure all document host-clock drift as a known issue across VM live migrations and cold starts in their tracing best-practices guides.
- Datadog, Honeycomb, and Tempo all clamp negative-duration spans at render time and emit a warning event rather than failing the trace.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you monitor clock skew across the fleet?
Run chrony on every host, scrape its 'offset to server' metric to Prometheus, alert at 50ms warning and 200ms critical. Cross-check with periodic ping-based clock-skew probes to a known good reference.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Treating tiny negative durations as a real anomaly to debug. They are nearly always clock skew artifacts; the real anomaly is anything more than a few hundred milliseconds, which means NTP is broken.
60 second bullets to scan on the way to the call.
Why each service stamps spans with its own wall clock
How network latency and clock offset interact to produce inverted timestamps
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.