Pcornel
Browse topics
Options
Recent
Favorites
Observability · Technical reference

Clock Skew and Timestamps

Direct answer

Clock skew between hosts makes telemetry timestamps disagree: spans with negative durations, logs out of order, rejected samples (out-of-order/too old).

When to use this

Use it when traces look impossible or backends reject data for timestamps.

First 30 seconds

1. Offset: chronyc tracking / timedatectl.

2. Metric: node_timex_offset_seconds.

3. Backend errors: out of order / too far in past.

4. Fix NTP sources.

5. Alert on offset > 100 ms.

Operational verification

host clock → timestamp on telemetry → backend ordering/validation

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
OpenTelemetry / Prometheus / Grafana / common metrics-log-trace pipelines
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformOpenTelemetry / Prometheus / Grafana / common metrics-log-trace pipelines
Scope / prerequisiteUse it when traces look impossible or backends reject data for timestamps.
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 How to verify Verify boundary

Alert on time offset from NTP above a small threshold. Check virtual machines after host migration or suspend.

Step 2 Common failures Narrow the fault

Containers use the host clock, so fix it on the node. Devices without NTP send logs with factory default dates. Mixing local time and UTC in log formats confuses correlation.

Key points

Run NTP/chrony everywhere and alert on offset. Prefer backend-assigned ingest time only when source time is unreliable.

Key checks
  • chronyc tracking — first check for this topic
  • curl -s localhost:9090/-/ready — Prometheus ready
  • curl -s 'localhost:9090/api/v1/query?query=up' — scrape targets up/down
  • promtool check config prometheus.yml — config valid
ReferenceWhat it is1 section · depth on demand

How it works

Each signal carries timestamps from the producing host. Backends accept data only within a window around their own time. Skew of even seconds makes traces confusing.

ReferenceImportant terms & boundaries3 sections · depth on demand

Detecting and fixing skew

timedatectl status ; chronyc tracking ; chronyc sources -v
w32tm /query /status
abs(node_timex_offset_seconds) > 0.05        # Prometheus alert on NTP offset

Symptoms: logs out of order, spans with negative durations, "sample out of order"/"too far in the future" rejections in Prometheus/Loki. Keep all hosts on NTP (chrony) with a reliable source, and prefer timestamps assigned at the source in UTC.

In depth

How skew shows up

SymptomCause
Child span starts before its parent; negative durationsClock difference between the two hosts
Logs from two services in the wrong orderProducers' clocks differ, or ingestion time used instead of event time
out of bounds / too old / too far in the future rejectionsBackend ingestion window (Prometheus, Loki, Cortex/Mimir)
TLS certificate is not yet validClock behind
Kerberos/AD KRB_AP_ERR_SKEWMore than 5 minutes difference (default tolerance)

Checking synchronisation

chronyc tracking            # "System time : 0.000012 seconds fast of NTP time", Leap status: Normal
chronyc sources -v          # ^* = selected source; reach 377 = last 8 polls OK
timedatectl                 # System clock synchronized: yes
w32tm /query /status ; w32tm /query /source ; w32tm /stripchart /computer:dc01 /samples:3
abs(node_timex_offset_seconds) > 0.05 or node_timex_sync_status == 0

Design that keeps time consistent

  • Every host, VM, network device and container node syncs to the same small set of internal NTP servers, which sync to trusted upstream sources.
  • Containers share the node's kernel clock; fix time on the node, not in the container.
  • VMs: let the guest's NTP client (chrony or the Windows Time service) discipline the clock and disable conflicting hypervisor time sync for domain controllers per vendor guidance; check clocks after live migration, snapshot restore and suspend.
  • Network devices: ntp server, clock timezone, and service timestamps log datetime msec so syslog carries precise times.

Event time vs ingestion time

Telemetry should carry the time the event happened, set by the producer; collectors should keep that timestamp and only fall back to receive time when none exists. Storing ingestion time hides skew and reorders events during backlog replay.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Common mistakes

  • Unsynchronised clocks breaking correlation.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
clock skew and timestampsclock skew telemetryntp chrony sync
Confirmation

Confirm action

Continue?