Out-of-order sample ingestion in Prometheus

Prometheus rejects samples older than its newest data by default. This page explains when to set out_of_order_time_window for late OTLP or remote write samples, how it changes too-old errors, and what it means for agent mode.

On this page

Out-of-order sample ingestion in Prometheus: when teams need a time window

If late samples from OpenTelemetry collector replicas or remote write senders are being rejected, the setting to examine is out_of_order_time_window. It defaults to 0s, which means Prometheus rejects any sample older than the newest one it has already stored for that series. A non-zero value accepts a late sample only when its timestamp falls within that window, measured back from the TSDB's maximum time. Samples outside the window are still refused. The window is a tolerance for delay, not a switch that makes Prometheus accept everything.

The Prometheus documentation describes the project as valuing reliability over precision, and it is explicit that Prometheus is not the right tool where 100% accuracy is required. Accepting late data fits that stance: a short window keeps recent but delayed points rather than dropping them. It does not fix the cause of the delay. Before raising the window, check whether the sender is batching, retrying or buffering in a way that could be corrected at the source. The OpenTelemetry guide for Prometheus recommends a window when receiving OTLP metrics, which makes OTLP receivers the most common case where a window is the right answer.

Teams should set a window only when delay is expected and bounded, such as a collector replica that flushes on a schedule or a remote write queue that retries after a network outage. Ask the sender team for its maximum expected delay, then size the window to cover it with margin. If delays are unbounded or come from a misconfigured pipeline, fix the sender instead. Note that a non-zero window also changes how errors are reported, since out-of-order and out-of-bounds failures merge into a single too-old error, so alerts and dashboards that count those errors should be reviewed when the window changes.

Configuration options and when each fits

This table compares three ways to set out_of_order_time_window: leaving it at the 0s default, a short window for jittery senders, and a wider window for batch or replica-based pipelines. Read each row as a trade-off between accepting late data and keeping too-old errors strict. The main takeaway is that every increase in the window accepts more late data but also makes the TSDB hold more out-of-order samples.

SettingWhat it acceptsCost and riskWhen it fits
Leave at 0s (default)Only samples at or after the current TSDB max time, with out-of-order and out-of-bounds errors reported separatelyStrictest too-old behavior; late samples from retries or replicas are rejected and show up as errorsDirect scrapes from a single server where samples arrive in timestamp order
Short window for jittery sendersSamples whose timestamp is at least the TSDB max time minus a small window, which absorbs network or batching delayLate samples beyond the window still fail as too-old; the TSDB keeps more out-of-order data in memory and on diskSenders such as a collector or relay that occasionally deliver a few seconds or minutes late
Wider window for batch or replica pipelinesSamples from replicas or backfilled batches that can arrive long after their timestamps, within the chosen windowLargest out-of-order footprint to hold; too-old errors cover fewer cases, so a misconfigured sender can hide behind the windowPipelines such as OpenTelemetry collector replicas or remote write receivers where delivery delay is known and bounded
Window sized to measured latenessExactly the lateness your senders produce, confirmed from their delivery logs or metricsRequires measuring sender delay first; an unmeasured window tends to be either too narrow or too wideTeams that can observe the delay distribution of each sender before choosing a value
Accepting late data for agent modeOut-of-order samples in the experimental agent WAL, relative to the last sample of the same seriesAgent mode is experimental, and the window applies per series, so it adds WAL work on every remote-write senderEdge or multi-cluster agents that forward to central storage and must tolerate delayed delivery
Strict too-old errors for alertingUnchanged error signal, so a sender that falls behind shows up quickly in logs and dashboardsLate data is dropped, which can leave gaps in rules and alerts built on those seriesMonitoring estates where a silent gap is worse than a visible error and sender lag is watched closely

Setting out_of_order_time_window on a Prometheus server

This sequence moves a Prometheus server from rejecting late samples to accepting those that fall inside a window sized from measured lateness. Each step ends with a check so the change can be confirmed before it reaches production.

  1. Measure which senders produce late samples

    Start by identifying the senders whose samples arrive late, such as OpenTelemetry Collector replicas or remote write receivers. Count the too-old errors in the Prometheus logs and on the server's own metrics for the affected period, and note which jobs, instances or remote write sources they come from. For each sender, compare the sample timestamp with the time the server received it to estimate how late samples arrive. The step is done when you have a list of senders and a rough maximum lateness for each, recorded with the time range you measured.

  2. Confirm the lateness the window must cover

    Review the lateness figures from the first step and decide the window size with the owners of the senders. Confirm the largest lateness you expect, including occasional spikes during restarts or network interruptions, rather than sizing the window from a single average. Ask the sender team to confirm how their pipeline buffers and retries data so the figure reflects real behavior. The step is done when the team has written down one proposed value for the window and the senders it applies to.

  3. Set the window in the TSDB configuration

    Add out_of_order_time_window under the tsdb section of the Prometheus configuration file, with the value you agreed. The default is 0s, which keeps out-of-order ingestion off. Note that a non-zero window changes how out-of-order and out-of-bounds errors are reported, and that the experimental agent's WAL also accepts late samples within the window. Check the exact key placement against the Prometheus configuration reference before editing, and keep the change in version control. The step is done when the file validates with promtool check config.

  4. Reload or restart with the chosen method

    Apply the configuration using the method your environment supports. A reload through the lifecycle endpoint requires the --web.enable-lifecycle flag, which is disabled by default, so confirm that setting before relying on it. Otherwise restart the Prometheus process so it reads the new file. Record the time of the change so later error counts can be compared against it. The step is done when the server reports the new configuration as loaded and the process is healthy on its targets page.

  5. Verify that too-old errors drop

    Compare too-old error counts and the logs for the affected senders before and after the change. Errors from samples that now fall inside the window should stop appearing. Keep in mind that samples older than the window still fail, so some errors should remain if a sender sometimes exceeds the window. The step is done when the error rate for the senders you measured has fallen and the remaining errors can be traced to samples outside the window.

  6. Confirm the window covers observed lateness

    Run the lateness measurement from the first step again for a representative period after the change. Check that the largest observed lateness sits inside the configured window with some margin. If late samples still arrive beyond it, decide whether to widen the window, fix the sender's buffering, or accept the loss and document it. Remember that a wider window keeps more data in memory and in the WAL, so the trade-off belongs in the change record. The step is done when the measured maximum lateness is within the window and the decision is recorded.

  7. Record the setting and its review date

    Write down the final window value, the senders it covers, the measured lateness that justified it, and the date of the change in the configuration repository or runbook. Assign an owner who reviews the window when a sender changes its pipeline or the error rate rises again. This keeps the setting traceable for the people who run the server later. The step is done when the record is merged and linked from the team's monitoring documentation.

What a non-zero window changes in agent mode

A non-zero out_of_order_time_window also changes the experimental agent WAL. When it is above zero, the agent accepts out-of-order samples that fall within the window, measured against the last sample written for the same series. That matters for scrape-and-forward edge collectors, which often buffer samples while a link to central storage is down and then flush them late. Without a window, those late samples are rejected as too old. With one, they can be written to the WAL and forwarded. The setting is a tolerance for reordering, not a guarantee that every late sample arrives intact, so the window must still be sized against how long your edge sites can actually be disconnected.

Agent mode is a deliberate reduction in what the process does. It scrapes, writes to the WAL and forwards through remote write, but it gives up local queries, local rule evaluation and alerting. Those functions must run in the central Prometheus server, Thanos, Mimir or another backend that receives the forwarded data. Before you enable the window on edge agents, confirm which of these capabilities you actually need at each site. If a site must keep alerting during a WAN outage, agent mode will not cover that case, and a full server or a different design is the better fit. Check how much WAL the agent retains and how long it can replay after a restart, since both shape the disk you need at the edge.

Because the agent WAL behavior is tied to an experimental feature, confirm it against the exact Prometheus version you run before relying on it. Read the configuration reference for your release and test a controlled out-of-order replay in a staging environment: disconnect an agent, generate samples, reconnect it and verify in the central store that the late samples landed and that nothing unexpected was dropped. Watch for samples rejected as too old in agent logs and metrics, and confirm that the central receiver accepts what the agent sends. Record the tested version, the window value and the outage duration you validated. Those notes become the operating baseline for upgrades, which should be planned against the Prometheus release cycle.

How late samples move through OTLP and remote write into the TSDB

The path starts when an OpenTelemetry collector replica or a remote write sender delivers a sample to Prometheus. Prometheus compares the sample timestamp with the TSDB max time minus out_of_order_time_window. Samples inside the window are ingested; older ones are rejected as too-old. When agent mode is in use, the experimental agent WAL applies the window relative to the last sample for the same series, so check that branch separately.

Late samples are accepted or rejected against the out-of-order window.

Security and operational risks of accepting late samples

Accepting late samples widens what a remote write endpoint will take in, from who sends it to how much data it stores and how alerts behave. The cards below cover the controls and checks to put in place before raising out_of_order_time_window and the signals to watch after the change.

Unauthenticated receivers accept any timestamp

A remote write receiver that accepts out-of-order samples will also accept samples whose timestamps fall anywhere inside the window, so anyone who can reach the endpoint can write data into the recent past. Confirm that every receiver sits behind authentication and that only known senders, such as your OpenTelemetry collector replicas, can reach it. Test with a sender that is not on the allow list before the change goes live.

Security model

Keep TLS and authentication on receivers

The Prometheus security model supports TLS and client certificate authentication, with TLS 1.2 as the minimum, and HTTP basic authentication with bcrypt-hashed passwords. Basic authentication without TLS exposes credentials in cleartext, so a receiver that accepts late samples over plain HTTP is a credential leak. Check the certificate chain and client certificate rules on every sender path, including any load balancer in front of the receiver.

Disk and WAL growth from wider windows

A wider out_of_order_time_window keeps more out-of-order data in memory and in the write-ahead log before it is compacted into blocks. Local storage is not clustered or replicated, so growth on one node affects that node alone. Before raising the window, measure WAL size and disk headroom under a late-sample burst, and confirm retention limits still hold the disk within budget.

Block size
2 hours

Alert evaluation skew from backfilled data

Samples that arrive late can change the value a rule sees for a past evaluation window, and a recording rule that reads recent data may produce a different result after a replay. Alerts that fire on rate or absent conditions may flap or resolve when late data lands. Review alert rules that depend on recent windows, and decide whether a late sample should be able to resolve a page that has already fired.

Cardinality from replayed series

Replay pipelines, retries and collector restarts can resend series with label sets that were never seen by the live scrape path, such as stale pod names or a changed job label. Each new label combination creates a new series and adds memory and index load. Compare series counts before and after a replay, and check that the OpenTelemetry collector's resource attributes map to the labels you already use.

Monitor rejection counters after the change

Because out-of-order and out-of-bounds errors merge into one too-old error after the window is set, a single rejection counter now covers more causes. Watch the rejected sample counts on the receiver and on each sender after the change, and compare them with the baseline taken before the window was raised. A rising count after a collector restart or clock drift on a sender points to a source that needs fixing, not a larger window.

Questions teams ask before changing out-of-order settings

Should we fix the sender before raising out_of_order_time_window?

Usually yes, or at least check the sender first. A non-zero out_of_order_time_window lets Prometheus accept late samples, but it does not make the data arrive in order, and a wide window hides a sender that is misconfigured or badly batched. Start by finding out why samples arrive late: retry queues, batching intervals, replica restarts or clock drift on the sending side. Fix what is cheap to fix, then set the window to cover the lateness that remains. The OpenTelemetry guide recommends a window when receiving OTLP metrics, so the window is a supported choice, but it should be a considered one.

What does changing the window cost, and who does the work?

The setting itself is a one-line change in prometheus.yml or the startup flags, so the cost is in the investigation and validation around it. Your platform team pays for measuring sender lateness, changing the sender configuration if needed, testing and reviewing alerts. A partner or consultant is paid for the same work if you outsource it. Costs recur only if the window needs retuning when senders change. Ask any quote to list who measures lateness, who owns the sender changes, how many environments are covered and what the retest includes.

How long does it take to validate a new window?

The duration depends on how long you need to observe real sender behavior, which usually means covering the normal traffic cycles and any known restart or failover events, not just a few minutes of tests. The Prometheus facts supplied for this topic do not give a fixed duration, so confirm the observation period with your own data. Plan for the period to include a check of too-old errors before and after the change, a review of rules and alerts that depend on recent samples, and a look at memory and disk use.

What must our team provide before the work starts?

Three inputs make the work faster and cheaper. First, sender lateness data: how far behind samples arrive, per sender and per replica, ideally from metrics you already collect. Second, a test environment that runs the same sender versions and a Prometheus build or configuration close to production. Third, alert review: a list of rules and alerts that could fire differently when late samples are accepted, and the owners who will check them. Without these, the window is a guess and the validation takes longer.

Can our own team make this change without outside help?

Yes, if your team already runs Prometheus and the senders in question, and has time to read the TSDB behavior carefully. The change itself is small. The effort is in understanding where lateness comes from, testing the window against real traffic and checking that alerts still mean what they should. Teams that lack this experience with OpenTelemetry collectors or remote write receivers often spend more time on diagnosis than on the setting. A partner can take that diagnosis and the validation as a fixed-scope piece of work, with the written scope agreed before work starts.

How do we size the window without a fixed figure?

Size it from measured lateness, not from a default or a number copied from another team. Measure the gap between the sample timestamp and the time Prometheus receives it for each sender, then look at the spread, including the worst cases after restarts or network issues. The window needs to cover the lateness you intend to accept, and a wider window increases how far back Prometheus will accept data and how much out-of-order data it must handle. Pick a value that covers the normal and recovery cases you have measured, then confirm it in the test environment.

What happens to too-old errors after the window is set?

Samples inside the window are accepted, and samples older than the window still fail. The supplied topic facts say that when the window is above zero, a sample is accepted if its timestamp is at least the TSDB max time minus the window, and that out-of-order and out-of-bounds errors merge into one too-old error. Your team should therefore expect the error type to change in logs and dashboards, so update any alert or query that matches on the old error messages before the change goes live.

Official Prometheus documentation for out-of-order ingestion

Read the Prometheus configuration reference before you change any ingestion setting, because out_of_order_time_window is a global TSDB setting with side effects that are easy to miss. The reference documents the default of 0s, the acceptance rule (a sample is ingested when its timestamp is at least the TSDB max time minus the window), and the merging of out-of-order and out-of-bounds errors into a single too-old error. Use it as the source of truth for the exact field name and syntax in your version, and check the release notes for your Prometheus line before you copy any example into production. The configuration reference is at Prometheus configuration.

Read the Prometheus OpenTelemetry guide next if your samples arrive over OTLP from Collector replicas, because the guide recommends setting an out-of-order time window for OTLP metrics. Pay attention to how it frames the window as a tolerance for delivery delay between senders and the server, not as a general relaxation of ordering rules. Then confirm with your Collector team how far their retry and batching behavior can delay a sample, since that delay is the number the window has to cover. The guide is at Prometheus OpenTelemetry guide.

If you run the experimental agent mode, the configuration reference also notes that a non-zero window lets the agent's WAL accept out-of-order samples relative to the last sample for the same series. Confirm in your own test environment how the agent behaves at the window boundary before relying on it, and record the Prometheus version you tested against. Pair the reading with a short trial against a non-production receiver so the team can see the too-old errors in their own logs rather than inferring them from documentation.

How DeployOpen scopes and delivers out-of-order ingestion work

DeployOpen approaches out-of-order ingestion as a configuration decision with consequences for storage, error handling and agent mode, so we start by mapping which senders produce late samples. We then build and test the window setting against those senders, and hand over the configuration, tests and runbook in your own infrastructure.

How we scope

  • We list every sender that can deliver late samples, such as OpenTelemetry Collector replicas and remote write receivers.
  • We document the current too-old errors and the sample delays you observe, so the window value rests on evidence.
  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.

How we build

  • We set out_of_order_time_window on the Prometheus servers in scope and record why that value was chosen.
  • We test late-sample ingestion against each sender and confirm how too-old errors appear after the change.
  • We check whether any agent mode collectors in scope need the window, and document the effect on their WAL.

How we hand over

  • You receive the configuration files, test results and a record of the chosen window with its reasoning.
  • A runbook explains how to read too-old errors, change the window and roll back in your environment.
  • Your team gets a walkthrough of the tests so they can rerun them after future sender or version changes.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers for teams that change senders often.
  • Retainer work can revisit the window when new OpenTelemetry or remote write senders join the estate.
  • Confirm with your vendor or your own environment what each Prometheus release supports before any upgrade.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.