Skip to content

Forward raw readsb JSON to the stats endpoint on a dedicated timer#143

Merged
d4rken merged 2 commits into
devfrom
feeder-stats
Jun 19, 2026
Merged

Forward raw readsb JSON to the stats endpoint on a dedicated timer#143
d4rken merged 2 commits into
devfrom
feeder-stats

Conversation

@d4rken

@d4rken d4rken commented Jun 19, 2026

Copy link
Copy Markdown
Member

Feeders now upload their raw readsb JSON (aircraft, stats, and range-outline documents) to the backend roughly every two minutes on a dedicated airplanes-stats timer. The server derives the per-feeder reception statistics from those documents, so new statistics can be added on the server without updating the fleet.

This replaces the earlier approach where a handful of computed scalars were posted alongside diagnostics. The diagnostics push is now device-health only; the stats upload runs on its own timer and lane.

The upload reuses the existing reporting-consent toggle, validates each document on its own (a missing or half-written file is skipped, never sent as a fragment), drops stale snapshots, and is strictly best-effort — a failed push is logged and retried on the next tick, never failing the unit. Bodies are gzip-encoded and bounded to the server's size limits, dropping the optional outline document before skipping if a dense receiver would exceed them.

d4rken added 2 commits June 19, 2026 21:50
Add airplanes-stats.sh and its 120s systemd timer to upload the
forwarder's raw aircraft/stats/outline readsb JSON, gzip-encoded, to the
backend, which extracts per-feeder reception metrics. Rides the existing
REPORT_STATUS consent, validates each document independently, skips stale
or oversize snapshots, and is best-effort (a failed push never flaps the
unit). Adds post_gzip_bearer for Content-Encoding: gzip uploads and a
shared report_status_consent resolver in common.sh.
The feeder-attested stats lane moved to airplanes-stats.sh, so remove
build_reception_json and the /api/feeders/reception POST from the
diagnostics run. Resolve REPORT_STATUS via the shared report_status_consent
helper so the privacy fail-closed rule is single-sourced.
@d4rken d4rken added the enhancement New feature or request label Jun 19, 2026
@d4rken d4rken merged commit 71d71ec into dev Jun 19, 2026
13 checks passed
@d4rken d4rken deleted the feeder-stats branch June 19, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant