Logit.io
Prometheus remote write falling behind: find the lag
← Back to blog
11/24/2026 · 16 min read

Prometheus remote write falling behind: find the lag

Logit.io Team
Logit.io Team
Technical Content Team

Last updated 11/24/2026

How To GuidesTips

When Prometheus remote write is falling behind, check the same series locally and on the destination, then compare the sender’s newest input with each destination’s highest sent timestamp. Read that gap alongside pending samples, retries and send errors.

Where did the latest samples stop? Start here if a previously working remote graph ends early while the local graph still looks current. The timestamps, queue figures and HTTP responses below are illustrative.

The walkthrough uses a Prometheus 3.5.0 sender with two loopback destinations. Those local receivers are only there to show sender-side queue behaviour. On Logit.io, remote write lands on VictoriaMetrics, at a host of the form your-stack-id-vm.logit.io. Copy the unique URL from your Metrics stack rather than inventing one. Open received series with Launch Metrics, which starts Grafana (Grafana OSS 13.0.2). Sender queue counters such as prometheus_remote_storage_* belong to the Prometheus you run, not to Logit.io. See the Metrics storage overview and the Remote Write settings.

Contents

Source freshness

Local and remote sample times

Pick one missing series. Write down its metric name and identifying labels, the dashboard data source, the UTC incident window and the timestamp of the last visible sample. Use a fixed end time on both sides. A rolling “last 15 minutes” display can move between checks, and a panel’s step, aggregation or transformation can hide the last raw point. If write relabelling or external labels change its identity, write down the selector before and after that change.

On the customer-run sender, evaluate the raw selector and its sample timestamp at the agreed end time. Run the equivalent selector on the destination view at the same evaluation time. In this example, the source selector is the same at both destinations for channel="main". The timestamp returned by timestamp() is the selected sample’s time in epoch seconds. An instant query can select an earlier sample within lookback or return an empty vector. To see the actual timestamps in the missing minute, evaluate the range selector as an instant query at its end time and inspect the returned samples.

timestamp(demo_signal{job="demo",instance="127.0.0.1:18080",channel="main"})
demo_signal{job="demo",instance="127.0.0.1:18080",channel="main"}[1m]

Compare the two results with the expected scrape cadence. If the local point is already old, check the scrape target and the series it exposes. up can be 1 while an exporter omits one metric, so check the affected selector even when the scrape succeeds. If the raw point is current in both places and the dashboard still looks stale, check the panel’s query, selector, data source and range against the one you just tested.

Queue gap per destination

Sent timestamp versus input timestamp

The input gauge is a sender-wide maximum for samples received by the remote-storage appender. It has no destination label. The sent gauge has a separate series for each queue. Both report epoch seconds in this version. Capture them from the same sender at the same observation time. If your monitoring system scrapes several Prometheus instances, select one sender before doing the subtraction and retain the remote_name label. A result that uses the newest input from one sender and the sent timestamp of another has no operational meaning.

The Prometheus 3.5.0 sent gauge can advance after a batch ends in a non-retryable error. It can also move as soon as any series advances. Use it to locate queue progress and check receiver query results for evidence that your series arrived. Zero is the initial value of these timestamp gauges. An uninitialised value or a missing time series calls for checking startup and monitoring coverage first.

prometheus_remote_storage_highest_timestamp_in_seconds
  - on (job, instance) group_right
    prometheus_remote_storage_queue_highest_sent_timestamp_seconds{remote_name=~"local-a|local-b"}

prometheus_remote_storage_samples_pending{remote_name=~"local-a|local-b"}

increase(prometheus_remote_storage_samples_retried_total{remote_name=~"local-a|local-b"}[1m])

increase(prometheus_remote_storage_samples_failed_total{remote_name=~"local-a|local-b"}[1m])

rate(prometheus_remote_storage_sent_batch_duration_seconds_sum{remote_name=~"local-a|local-b"}[1m])
  / rate(prometheus_remote_storage_sent_batch_duration_seconds_count{remote_name=~"local-a|local-b"}[1m])

Use the last four expressions over the same window for pending samples, retried samples, failed samples and mean send-attempt duration in seconds. The last expression is defined when the send-attempt counter increases. Retries and failures count samples, so a single batch can add more than one to either counter and the retry counter can count the same sample again. The pending gauge can include an in-flight batch and covers the shard queues. Some data may still be waiting in the write-ahead log (WAL). Record the starting and ending gauge values and look at the peak. When sharing sender diagnostics, capture the destination name, status class, timing and counters. Keep credential-bearing URLs out of logs and shared captures.

Use this worksheet to compare snapshots. Each offline row has the same observation time, and the sample input time is distinct from it. The lag is 12:04:58 − 12:04:55 = 3 s for A and 12:04:58 − 12:01:58 = 180 s for B. The times, backlog and response classes below are invented for an offline worksheet, independent of the queue settings in the loopback example. The 3 s and 180 s are example arithmetic.

WhereObservation time (UTC)Newest sender input (sample time, UTC)Highest sent timestamp (UTC)Calculated gapPending samplesResponse class during window
Sender12:05:0012:04:58———Scrape success
A / local-a12:05:0012:04:5812:04:553 s42xx
B / local-b12:05:0012:04:5812:01:58180 s365xx

A 180-second gap is a prompt to inspect B over the next few observations. It places two maxima three minutes apart. Let the source owner confirm which samples actually exist in that window and let the dashboard owner identify which of those are visible at B. Record the exact selectors and time interval alongside the worksheet, especially during a cutover when both destinations are configured.

A local loopback example

Use Prometheus 3.5.0 for the sender and both local receivers. The target at port 18080 returns two invented gauge series on each one-second scrape. The sender writes Remote Write 1.0 to two loopback stubs on ports 19091 and 19092. In success mode, each stub forwards the compressed request to its own local Prometheus receiver and returns the receiver’s status. Error modes return a canned status without forwarding the batch. Each receiver has a separate TSDB. B’s write relabelling drops only the aux variant of demo_signal. Both destinations keep only the example metric, and metadata sends are disabled to isolate sample sends.

Save this sender configuration as sender.yml. The small single-shard queues and backoff settings make the lab easy to observe.

global:
  scrape_interval: 1s
  scrape_timeout: 500ms

scrape_configs:
  - job_name: demo
    static_configs:
      - targets: ['127.0.0.1:18080']

remote_write:
  - name: local-a
    url: http://127.0.0.1:19091/api/v1/write
    protobuf_message: prometheus.WriteRequest
    remote_timeout: 2s
    metadata_config:
      send: false
    write_relabel_configs:
      - source_labels: [__name__]
        regex: demo_signal
        action: keep
    queue_config:
      min_shards: 1
      max_shards: 1
      capacity: 40
      max_samples_per_send: 2
      batch_send_deadline: 250ms
      min_backoff: 250ms
      max_backoff: 1s
      retry_on_http_429: true
  - name: local-b
    url: http://127.0.0.1:19092/api/v1/write
    protobuf_message: prometheus.WriteRequest
    remote_timeout: 2s
    metadata_config:
      send: false
    write_relabel_configs:
      - source_labels: [__name__]
        regex: demo_signal
        action: keep
      - source_labels: [__name__, channel]
        regex: 'demo_signal;aux'
        action: drop
    queue_config:
      min_shards: 1
      max_shards: 1
      capacity: 40
      max_samples_per_send: 2
      batch_send_deadline: 250ms
      min_backoff: 250ms
      max_backoff: 1s
      retry_on_http_429: true

Save the following as stubs.py in a fresh working directory and run python3 stubs.py in its own terminal. It needs only the Python standard library. The default B response mode is success.

import http.client
import time
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
from threading import Event, Thread

class Stub(BaseHTTPRequestHandler):
    def do_GET(self):
        if self.server.server_port != 18080 or self.path != "/metrics":
            self.send_error(404)
            return
        self.send_response(200)
        self.send_header("Content-Type", "text/plain; version=0.0.4")
        self.end_headers()
        self.wfile.write(
            b'# TYPE demo_signal gauge\n'
            b'demo_signal{channel="main"} 1\n'
            b'demo_signal{channel="aux"} 2\n'
        )

    def do_POST(self):
        port = self.server.server_port
        if port not in (19091, 19092) or self.path != "/api/v1/write":
            self.send_error(404)
            return
        body = self.rfile.read(int(self.headers["Content-Length"]))
        mode = Path("b-status")
        status = int(mode.read_text()) if port == 19092 and mode.exists() else 204
        if status == 204:
            if port == 19092:
                time.sleep(0.38)
            upstream = http.client.HTTPConnection("127.0.0.1", port + 100, timeout=2)
            try:
                headers = {name: self.headers[name] for name in (
                    "Content-Type", "Content-Encoding", "X-Prometheus-Remote-Write-Version"
                )}
                upstream.request("POST", self.path, body=body, headers=headers)
                response = upstream.getresponse()
                status = response.status
                response.read()
            except OSError:
                status = 502
            finally:
                upstream.close()
        self.send_response(status)
        self.end_headers()

for port in (18080, 19091, 19092):
    server = ThreadingHTTPServer(("127.0.0.1", port), Stub)
    Thread(target=server.serve_forever, daemon=True).start()
Event().wait()

In the same directory, use the 3.5.0 prometheus and promtool binaries on your path. Start both receivers before the sender. Save the shell block as run-local.sh and run it with Bash in a terminal you can keep open. Press Ctrl+C there and in the stub terminal when you finish.

set -e
printf 'global:\n  scrape_interval: 1m\nscrape_configs: []\n' > receiver.yml
promtool check config sender.yml receiver.yml
prometheus --config.file=receiver.yml --storage.tsdb.path=./data-a \
  --web.listen-address=127.0.0.1:19191 --web.enable-remote-write-receiver &
a=$!
prometheus --config.file=receiver.yml --storage.tsdb.path=./data-b \
  --web.listen-address=127.0.0.1:19192 --web.enable-remote-write-receiver &
b=$!
trap 'kill "$a" "$b"' EXIT
for port in 19191 19192; do
  until curl -fsS "http://127.0.0.1:$port/-/ready" >/dev/null; do sleep 1; done
done
prometheus --config.file=sender.yml --storage.tsdb.path=./data-sender \
  --web.listen-address=127.0.0.1:19090

Let both destinations accept samples before opening the observation window. The small manual example scrapes only the example target. To inspect sender instrumentation, read its loopback exposition directly. The PromQL above is for a monitoring instance that scrapes the sender. Retrieve the same sample window from ports 19090, 19191 and 19192 by setting a single evaluation time and using the instant-query API with the range selector.

curl -fsS http://127.0.0.1:19090/metrics |
  grep -E '^prometheus_remote_storage_(highest_timestamp_in_seconds |queue_highest_sent_timestamp_seconds\{|samples_(pending|retried_total|failed_total)\{|sent_batch_duration_seconds_(sum|count)\{)'

end=$(date -u +%s)
for port in 19090 19191 19192; do
  curl -fsSG "http://127.0.0.1:$port/api/v1/query" \
    --data-urlencode 'query=demo_signal{job="demo",instance="127.0.0.1:18080",channel="main"}[1m]' \
    --data-urlencode "time=$end"
  printf '\n'
done

The matching evidence branch

Four evidence branches

  1. Stale source data. The affected raw sample is already old or missing in local Prometheus. Inspect target and exporter health and any scrape-time relabelling. An advancing sender-wide input gauge can come from other series. Verify fresh points for the affected selector locally before interpreting the destination gap.
  2. Growing sender lag. The local series is current, the sent timestamp advances more slowly than new input and pending samples accumulate or sit near their queue ceiling. Check response classes and attempt durations at the same time. If a shard queue fills, the WAL reader for that destination can be blocked from taking more samples. Pending may then look flat while the timestamp gap grows. If one destination stays current, start by investigating the slower destination’s write path.
  3. Sender response errors. In the pinned 3.5.0 example, a 2xx completes a send, 5xx is retried with backoff and retry_on_http_429: true makes 429 retryable. Other 4xx responses, including 401 and 403, end the batch without retry. Inspect sender errors for the response class and use the failed-sample count to check whether rejected batches are being discarded. Work with the destination owner on the rate limit, availability or authentication issue indicated by the responses.
  4. A missing series excluded by a filter. The local series is current, the destination has fresh traffic, and the effective write relabelling rule removes this label set. Read the destination’s rules in order and check the exact labels after any earlier rules. In this example A retains both series, so it provides a direct comparison for B. If you need to decide which series to keep, review the write-relabel rules and the queries that depend on those series before you drop them.

Test B with the following cases. Leave A in success mode as the control. Set each status for roughly the same 12-second window, record the counters and gauge at both ends, then return B to success and allow it to settle before starting the next case. Use the same sender throughout so that counter changes can be compared without a restart. The example contains no auth material. The 401 only simulates the response.

set_status() {
  printf '%s\n' "$1" > b-status.next && mv b-status.next b-status
}

# Run one line at a time. Capture before and after.
set_status 204   # Successful receiver writes
set_status 429   # Rate limit for 12 s, then set 204
set_status 401   # Auth error for 12 s, then set 204
set_status 503   # Transient server error for 12 s, then set 204

The table reports one measured loopback run. Pending shows start, peak and end. Retry and failed counts are differences over each 12-second window, and timestamp advance is end minus start. All measured times here are UTC on 24 November 2026. Send timing is the mean duration of observed attempts in that window. The stub returns errors immediately, so quick failed attempts can coincide with growing lag while the sender is backing off.

TestQueueObserved HTTPObservation window (UTC)Sent timestamp advancePending (start → peak → end)Retried samples ΔFailed samples ΔMean attempt
B: HTTP 204local-a20400:27:13.439 to 00:27:25.44312 s0 → 0 → 0002.08 ms
B: HTTP 204local-b20400:27:13.439 to 00:27:25.44312 s0 → 1 → 0002.38 ms
B: HTTP 429local-a20400:27:33.452 to 00:27:45.45412 s0 → 0 → 0001.68 ms
B: HTTP 429local-b42900:27:33.452 to 00:27:45.4540 s0 → 12 → 121201.23 ms
B: HTTP 401local-a20400:27:53.463 to 00:28:05.46512 s0 → 0 → 0001.95 ms
B: HTTP 401local-b40100:27:53.463 to 00:28:05.46512 s0 → 1 → 00121.11 ms
B: HTTP 503local-a20400:28:13.474 to 00:28:25.47612 s0 → 0 → 0001.55 ms
B: HTTP 503local-b50300:28:13.474 to 00:28:25.4760 s0 → 12 → 121201.17 ms

In the 401 window, B’s sent gauge kept advancing even though its receiver had no main-channel samples for that window after recovery. B’s failure count increased and pending stayed low. The 429 and transient 503 windows kept a batch in retry and caused pending to build up. After reset to success, all 12 main samples from each of the 429 and 503 windows matched B’s stored samples at their original timestamps.

Recognising catch-up

Catch-up checks

After the receiver starts accepting batches, take multiple snapshots at comparable intervals. With fresh input still arriving, the sent timestamp should advance faster than the input timestamp while the queue drains. Check that the gap returns to its usual range and pending drops back to its baseline. Inspect retries and failures over a recent window as well. A cumulative retry counter can remain high after retries cease. If pending falls during continuing rejections, check whether the queue is clearing by losing batches.

In the measured local run, B resumed successful writes with a deliberate 380 ms stub delay so the drain could be sampled. Below, the gaps are calculated from the two measured timestamps.

B / local-bObservation time (UTC)Newest sender input (UTC)Highest sent timestamp (UTC)Calculated gap from measured timestampsPending samplesHTTP at this phase
End of error window00:27:45.45400:27:4400:27:3212 s12HTTP 429
End of recovery window00:27:53.45700:27:5200:27:520 s0HTTP 204
End of error window00:28:25.47600:28:2400:28:1212 s12HTTP 503
End of recovery window00:28:33.47900:28:3200:28:311 s1HTTP 204

Now check coverage. Query the exact series on the sender and receiver over the same bounded UTC interval. Compare the timestamp/value pairs directly. A range selector evaluated at the agreed end gives the underlying sample times, which can be compared even when the graph uses a coarser step. For this example, the main series shows that B recovered from the transient response errors. The aux series shows what a healthy queue can miss.

For this panel, both receiver queries used the same four-second window ending at 00:28:31.479 UTC. The gap and pending gauge were close to baseline by the end of recovery.

Series in the same settled windowLocal sender samplesA receiver samplesB receiver samplesB comparison against the source
demo_signal / main444All timestamp/value pairs matched
demo_signal / aux440All source points absent under the filter

Record the missing intervals separately from return-to-current time. In this run the main series had a gap at B during the 401 window and the aux series had a gap for the entire sampled filter window. Both remained missing after catch-up. The rejected main-channel batches and filtered aux samples cannot be reconstructed from B’s stored points. The originals remained on the sender and on A during the example. In an incident, preserve any surviving source copy and record which intervals you cannot reconstruct. Queue recovery by itself supplies no backfill.

  • B main after HTTP 401. 12 missing samples with UTC timestamps from 00:27:53.955 to 00:28:04.955.
  • B aux with the filter in place. 4 missing samples from 00:28:27.955 to 00:28:30.955 UTC in the checked window. The rule excludes that label set throughout the run.

If you are validating a cutover, agree on the required series, the UTC window and the acceptable freshness before disabling the old destination. Keep the destination-specific incident record open for any unresolved historical gap. Use the per-series query to establish which samples arrived. Once you have checked the affected samples and the sender’s queue, check active metrics, metrics per minute and historical usage for stack-level context in Metrics Statistics.

Start Free Trial

Unlock complete visibility with hosted ELK, Grafana, and Prometheus-backed Observability

Start Free Trial

FAQ

Does this Prometheus sender retry HTTP 429 responses?

Yes. Setting retry_on_http_429: true in the remote-write queue config enables 429 retries for that destination in Prometheus 3.5.0. Check the effective config on the sender that owns the queue.

Why can pending samples be near zero while the remote graph has gaps?

The gauge measures samples pending in the shard queues. It can stay low when batches fail without retry or when a series is filtered before enqueueing. Check sample failures and the exact missing selector. If failures and pending are both flat, inspect the series at the source and inspect the write relabelling rules.

Would a slower scrape help?

A longer interval reduces input for that job and changes the data’s sampling resolution. Confirm sustained input pressure before considering it. A change to future scrape cadence leaves the earlier missing minute unresolved, and an auth failure still needs to be corrected.

What if the first remote graph was always empty?

Start by establishing receipt of one series in Grafana Explore. On a Logit.io Metrics stack, click Launch Metrics to open Grafana (Grafana OSS 13.0.2). For setup, copy the unique destination URL from the Metrics stack. That URL is a VictoriaMetrics endpoint on a host of the form your-stack-id-vm.logit.io. See the first metrics walkthrough and the Remote Write settings.

Can I use these Metrics features during the free trial?

The Logit.io free trial includes every feature, including Remote Write and Metrics Statistics. The trial lasts 14 days and requires no credit card. See Getting started.

Next steps

  • After verifying the affected samples, check active metrics and usage in Metrics Statistics.
  • For connection setup, copy your destination from the stack’s Remote Write settings.
  • To decide which series should be sent, review the write-relabel rules and the queries that depend on those series before you drop them.

Get the latest Elastic Stack & logging resources when you subscribe

Want to see this in action?
Start a free trial and connect logs to your alert workflows.