Production-grade guide to edge time series processing covering architecture patterns, implementation strategies, testing approaches, and operational best practices for enterprise engineering teams.
Edge Time Series Processing
Edge time series processing is the class of workloads that capture, reduce, and react to timestamped measurements where the source instruments are physically distributed and often connected through metered or intermittent networks. It matters when the latency budget for getting a measurement from sensor to actionable insight is measured in single‑digit hundreds of milliseconds, when the volume of high‑frequency samples (vibration at 1 kHz, GPS pings at 1 Hz, environmental reads every few seconds) would saturate a WAN link if every point were forwarded upstream, or when the edge node has only constrained compute and memory headroom. The edge agent—a lightweight process co‑located with the sensor suite—is responsible for ingesting raw samples, applying windowed reductions, flagging anomalies, and forwarding only the compressed state downstream. This reference page walks through the concrete steps, commands, and failure modes you’ll encounter when building or operating such a pipeline.
The first step is getting each measurement from the sensor or driver onto the edge node with its original timestamp intact. In practice, most edge agents expose a small HTTP endpoint or an MQTT topic for incoming samples. A minimal curl invocation that respects the common {ts, val} schema looks like:
curl -s -X POST http://localhost:8081/series \
-H "Content-Type: application/json" \
-d '{"ts": 1704067200000, "val": 23.7}'
The agent validates that ts is present, that it fits within the node’s acceptable epoch range (typically signed 64‑bit milliseconds), and that the payload size stays below the configured per‑point limit (often 1 KB). If the JSON is malformed or the timestamp falls outside the valid window, the agent responds with 400: invalid payload and logs REJECTED: missing or out‑of‑range timestamp. That error text is common across implementations that follow the de‑facto edge‑TS ingest pattern.
If the agent is MQTT‑based, the equivalent publish command uses the standard mosquitto_pub binary (present on most edge OS images):
mosquitto_pub -h edge-gateway -t "sensors/room/1" \
-m '{"ts":1704067200000,"v":23.7}'
The agent stores each inbound point in an in‑memory or on‑disk buffer, assigning it a monotonically increasing internal sequence number for later dedup.
Once samples are ingested, the agent must reduce them before they leave the edge, otherwise the uplink saturates quickly. The two most common window styles are tumbling (disjoint bins) and sliding (overlapping bins). A tumbling one‑minute window, for instance, aggregates every sample whose timestamp falls within [⌊ts/60000⌋·60000, ⌊ts/60000⌋·60000+60000) into a single summary row.
If the edge node runs a local Postgres instance—often deployed via a Docker sidecar—the reduction can be expressed as a plain SQL query:
SELECT time_bucket('1 minute', ts) AS minute,
avg(val) AS avg_val,
max(val) AS peak_val,
count(*) AS sample_count
FROM readings
GROUP BY minute
ORDER BY minute DESC
LIMIT 10;
This query uses Postgres’s time_bucket function, available in the standard 15.x release and requiring no extension beyond the core install. If the edge stores data in a TSDB that speaks the remote‑write protocol, the agent can batch‑push reduced points with:
curl -s --data-binary @reduced.json \
'http://edge-db:9001/api/v1/push'
The JSON payload follows the protocol’s envelope shape (timestamp + value‑pair tuples), but the exact key names are implementation‑specific; the pattern is always an array of (timestamp, value) tuples wrapped in the protocol’s outer envelope.
Edge devices seldom have GPS‑disciplined clocks. NTP sync intervals can be as wide as 64 seconds on minimal OS builds, and GPS is unavailable indoors. As a result, in‑order arrival is not guaranteed. The standard pattern introduces a watermark: the highest timestamp the agent has successfully processed, minus a configurable lateness tolerance. Any incoming sample whose ts falls below watermark − tolerance is treated as late.
The typical error log entry when a sample is discarded because it arrives too late reads:
2024-06-15T12:13:45Z INFO agent[1234]: REJECTED: timestamp 1704067100000 is 210s behind watermark 1704067300000, exceeding tolerance 60s
If the tolerance is set too low, legitimate late arrivals (e.g., due to radio retransmission) are dropped, causing under‑counting. If set too high, the buffer grows unbounded and the agent runs out of memory, triggering an OOM kill that is often mistaken for a network failure. The “sharp edge” here is that many deployments leave the tolerance at its default (often 0 or a very small value) and only discover the problem after a firmware rollout introduces slightly out‑of‑order radios.
Configuration typically exposes a duration parameter measured in seconds or milliseconds; the specific environment variable or config‑file key varies by implementation. Operators should verify the tolerance value after any clock‑sync change or OS upgrade.
After reduction, the edge agent batches the summary rows and pushes them toward a central store over the WAN. The transport is typically HTTPS, MQTT over TLS, or the remote‑write protocol. A concrete curl command to push a single reduced batch might look like:
curl -s -X POST http://core-instance/api/v1/series \
-H "Authorization: Bearer $EDGE_TOKEN" \
-H "Content-Type: application/json" \
-d '@batch.json'
where batch.json contains an array of reduced points, each with a ts (epoch‑ms) and a vals object. The core service validates the attached seq field; if the agent re‑sends a batch with a sequence number already acknowledged, the core responds HTTP 409: duplicate sequence number and logs DUPLICATE_SEQ: 8421. Idempotency is therefore driven by the agent maintaining a local, persistent last_ack_seq file (often /var/lib/edge/seq.txt) and skipping any POST whose leading sequence is ≤ that value.
When the uplink is intermittent, the agent persists outgoing batches to disk before acknowledgment. A useful recovery command after a link recovers is:
curl --retry 5 --retry-delay 2 -K <(printf 'Authorization: Bearer %s\n' "$EDGE_TOKEN") \
-F "file=@/var/lib/edge/outbound/batch.json" \
http://core-instance/api/v1/series/replay
The --retry flag is part of standard curl and respects the same back‑off logic the agent uses internally, ensuring that a transient 503 or 429 does not leave summary data stranded at the edge.
Several failure modes appear repeatedly in edge‑time‑series deployments and are easy to overlook until a production incident:
ts as integer milliseconds but the downstream store expects microseconds, comparisons such as WHERE ts > last_seen silently fail because the granularity mismatch causes every point to appear “not newer”. The symptom is a flat aggregate curve despite new sensor data being generated.max_batch_bytes limit is set to 500 KB (a common default) and the buffer holds 2 MB of reduced points, the HTTP response is 413 Payload Too Large and the agent drops the batch without retry, causing a silent data loss that shows up only as a gap in the time‑series chart. The fix is to either raise the core limit or configure the agent’s max_outstanding_bytes env var, but many operators leave both at default and remain unaware.memory.limit 256M). When the in‑memory ring buffer for incoming samples hits the limit, the agent’s write() syscall returns EAGAIN and the agent silently drops the packet, logging only DROP: buffer full. The operator sees no network error, only a gradually decreasing sample rate that correlates with peak sensor hours.When something goes wrong, having concrete commands to inspect, replay, or reset the pipeline speeds up diagnosis. The following patterns assume a Postgres‑based edge store reachable via psql and an HTTPS core API reachable via curl.
Check for missing windows. The SQL pattern below generates the expected series of one‑minute buckets between the earliest and latest timestamps in the table and left‑joins the readings table to expose gaps:
SELECT g.minute,
count(r.val) AS sample_count
FROM generate_series(
(SELECT min(ts) FROM readings)::timestamp,
(SELECT max(ts) FROM readings)::timestamp,
interval '1 minute'
) AS g(minute)
LEFT JOIN readings r ON time_bucket('1 minute', r.ts) = g.minute
GROUP BY g.minute
ORDER BY g.minute;
Any sample_count of 0 indicates a window with no ingested points—useful for spotting dropped ingests or watermark‑driven discards.
Replay a captured inbound session. If you have a JSONL dump of raw samples (e.g., from a tcpdump‑filtered MQTT capture), you can re‑inject them with:
while IFS= read -r line; do
curl -s -X POST http://edge-agent.local:8081/series \
-H "Content-Type: application/json" \
-d "$line"
done < /var/log/edge/capture.jsonl
The loop respects the agent’s per‑point validation; any point that fails validation is skipped and logged, allowing you to isolate the bad records without re‑processing the entire file.
Verify idempotency after a manual resend. After forcing a batch resend via the curl --retry pattern described earlier, confirm that the core did not create duplicate rows:
psql -c "
SELECT count(*) AS total,
count(DISTINCT seq) AS unique_seqs
FROM core.series;
"
If total equals unique_seqs, the replay was idempotent. A mismatch signals that some batches were sent with sequence numbers the core had already accepted, and a cleanup window (DELETE FROM core.series WHERE seq <= (SELECT max(seq) FROM core.series) - 1000) may be required.
Restart the edge agent after a config change. On most edge distributions, the agent runs as a system service:
systemctl restart edge-agent
followed by a health check:
systemctl status edge-agent | grep Active
If the service fails to start, inspect the journal for the specific config‑parsing error:
journalctl -u edge-agent -n 30 --no-pager
# Typical line: “failed to parse window duration unit; expected ‘s’ or ‘ms’”
The exact error text depends on the agent’s parser, but the pattern— a config‑key parse failure logged at startup—is universal across Go‑ and Rust‑based edge agents.
The effectiveness of an edge time‑series pipeline hinges on three invariants: every inbound sample carries a valid, monotonic timestamp; window reductions are applied consistently at the edge before WAN transit; and sequence numbers or idempotency keys guarantee exactly‑once delivery to the core store. When any of those invariants breaks, the failure is typically silent—a dropped point, a widened gap, a flat aggregate—until a chart diverges from expected behavior. Keeping the commands above in your operational toolkit, and understanding the temporal‑disorder mechanisms that drive them, is the difference between a pipeline that quietly degrades and one that you can debug in minutes.
This page was rewritten on 14 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.
We use cookies for analytics (Google Analytics) and advertising (Google AdSense) to improve your experience and support free content. Privacy Policy