Forward raw readsb JSON to the stats endpoint on a dedicated timer#143
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feeders now upload their raw readsb JSON (aircraft, stats, and range-outline documents) to the backend roughly every two minutes on a dedicated
airplanes-statstimer. 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.