Skip to content

Feat[Backend]: logging module in station crate - #685

Merged
JavierRibaldelRio merged 20 commits into
new-backendfrom
backend/logging
Dec 6, 2026
Merged

JavierRibaldelRio merged 20 commits into
new-backendfrom
backend/logging

Conversation

@pminmic

@pminmic pminmic commented Dec 2, 2026 •

Copy link
Copy Markdown

Summary

Adds station::logging to persist backend events into recording sessions using software_core::logger.

  • Creates timestamped backend and session directories under the configurable logging_path.
  • Stores session metadata and selected variables in logger_settings.json.
  • Writes headerless CSVs for measurements, protections, orders and messages.
  • Consumes the existing ToLogging channel directly on a dedicated writer thread, resolving metadata through the shared ADJ and protocol Index.
  • Provides session controls, buffered writes, periodic flushing and orderly shutdown.
  • Stops recording on write failures or observed input saturation while keeping the event receiver alive for subsequent sessions.

Orders are recorded after TCP confirmation, with the confirmed OrderPacket serialized as compact JSON. Protection durations come from their ADJ definitions.

Extra

  • Little modification in software_core::logger, in the CSV implementation: add method instant.

Follow-up work

Application startup and WebSocket control wiring remain pending. The planned integration is documented in WEBSOCKET_INTEGRATION.md.

Trace output and ADJ validator execution remain outside this implementation.

@pminmic
pminmic marked this pull request as ready for review December 3, 2026 14:44
Base automatically changed from backend/net to new-backend December 5, 2026 09:21
event::Channels renamed problems to notices and telemetry now reaches
pipeline on its own queue (pipeline_data), so the event integration test
waits there. Also formats the two files this branch touches and commits
the Cargo.lock order left by the merge.
A full input queue is backpressure: event waits for a slot and logging
keeps recording. Stopping the session on it lost every later record, and
right after a start that opens many files it could stop the session that
had just begun. Only write errors stop a session now.
The catalog only reads the boards. main already shares Arc<PodData> with
net and event (and moves pod_data out of the Adj), so logging can take
that same Arc instead of a separate copy of the whole ADJ.
…e error

Logging takes a clone of event's notices sender (②) and sends a Warning
when a session ends with StopReason::WriteError, so the operator learns
that recording stopped. It uses try_send: the router may be waiting for
room in logging's input, and waiting on ② would block both.
…of stopping

A NaN or infinite order parameter is bad input, not a disk failure. The
catalog now rejects it like any other invalid order (warning, row not
written) and the session keeps recording, instead of stopping it as a
write error.
LoggerCommand, the Commands fields and OrderForwarder::new were
pub(crate), so main (a separate binary crate) could not build the
Commands that connect the frontends to logging and event's orders.
serve_commands consumes websocket's LoggerCommand queue and drives
Logging: logger/variables ("<board>/<alias>") selects the next session,
logger/enable starts or stops it, and every enable is answered on
logger/response with the actual state. Without a selection every data
measurement is recorded, as competition-view expects.
@JavierRibaldelRio
JavierRibaldelRio merged commit 56e1cb2 into new-backend Dec 6, 2026
2 checks passed
@JavierRibaldelRio
JavierRibaldelRio deleted the backend/logging branch December 6, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants