Telemetry: location readings from devices into a time-series store, with latest position and a live view
- Dominant language
- C#
- Stars
- 6
- Forks
- 7
- Avg merge
- 4h 42m
- Merged PRs (30d)
- 307
Description
Arnel, 14 September 2026: vehicle tracking is one of the systems a barako expert should brew. Vehicles, drivers, routes and trips are content, geopoint and the near filter exist, DeviceTrust exists for devices. What does not fit is the location stream: a ping every few seconds per vehicle is not a content entry, and writing it as one would bury Postgres in events and audit rows.
## Change
- **Ingest.** A device posts batches of readings (`deviceId`, time, lat, lng, speed, extra numbers) to an ingest endpoint authenticated as a trusted device, idempotent per reading, accepting late and out-of-order readings from a device that was offline.
- **Storage apart from content.** Readings go to a time-series table partitioned by day (TimescaleDB when present, plain partitions otherwise) with retention per tenant, not to the event store.
- **Latest position** is kept on the vehicle entry (a geopoint plus time), throttled, so delivery, filters and the near filter work as they do today.
- **Live view.** A stream of latest positions for a signed-in viewer with the permission (#566), for a map block (BaryoDev/barakoPress#26).
- **Rules** such as geofence exits or speeding run in a service (#831), not in the ingest path.
## Done when
- A load test of 500 devices at one reading every 5 seconds holds p95 ingest under 100 ms on the documented server size, and a device replaying an hour of offline readings creates no duplicates.
## Where it lives
Module: `BarakoCMS.Telemetry`, owning its time-series tables and ingest endpoint. It authenticates devices with the core's device-bound tokens and does not depend on the DeviceTrust module.
Contributor guide
Research direction
No concrete file or test is named; start by locating the BarakoCMS.Telemetry module, its ingest endpoint, and its time-series table definitions. Read the device-bound token integration with DeviceTrust and the related rules service in #831, then review permission #566. Done means meeting the 500-device p95 ingest target and ensuring an hour of replayed offline readings creates no duplicates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, postgres
- Domain
- api, authentication, backend, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100