Datarouter Component Architecture#

Datarouter Architecture
status: draft
security: YES
safety: QM
bazel_module: score_logging
version: 1

Overview#

The Datarouter (Datarouter (comp__datarouter)) is the DLT daemon. It reads the log records of the mw::log clients from shared memory, filters them and sends them as DLT messages over UDP multicast.

Description#

A client (the remote/DLT backend of comp__mw_log_backend) connects to the Datarouter over the control channel (Control Channel (logic_arc_int__logging__datarouter_msg_client)), and the Datarouter creates a source session for it. The Datarouter periodically asks each client to hand over its buffer by a notification, then reads the log records from the shared-memory ring buffer of the client (Log Record Shared-Memory (logic_arc_int__logging__shared_memory)). Each record is parsed, filtered by log level per channel and sent over the configured DLT channel.

Design decisions:

  • Freedom from interference: the Datarouter is a separate process and only reads the shared memory of the clients.

  • A client that does not answer must not stall the other clients: the acquire request is a non-blocking notification, and a watchdog removes a session after a limited number of missed deadlines.

  • Messages are filtered early, with an own log level threshold per channel, to reduce the traffic.

  • Deployment-specific configuration (log-channels.json) without a rebuild.

Design constraints:

  • DLT output over UDP multicast only.

  • log-channels.json is mandatory, class-id.json is optional.

  • One worker thread serves all sessions.

The detailed design of the units is described in Datarouter Detailed Design (doc__datarouter_detailed_design).

Rationale Behind Architecture Decomposition#

The component is not split into lower level components. It is a single daemon process, decomposed into units by responsibility (session handling, shared-memory reading, parsing, DLT output, configuration), so that each unit can be tested and replaced independently. The units are described in the detailed design.

Note

Common decisions across components / cross cutting concepts is at the higher level.

Static Architecture#

Dynamic Architecture#

Initialization and Message Processing
status: valid
security: YES
safety: QM

The Datarouter creates the DLT server and a source session with its own parser for each new client. Each record read from shared memory is passed to the verbose, non-verbose or file transfer handler, filtered and sent over the DLT channel.

Client Session Handling
status: valid
security: YES
safety: QM

The Datarouter requests the buffer of each client by a non-blocking notification, reads the acquired buffer and forwards the records. A client that does not answer does not stall the other clients; its session is removed by the watchdog after a limited number of missed deadlines.

DLT Message Filtering
status: valid
security: YES
safety: QM

The log level threshold of a message is taken from log-channels.json (and class-id.json for non-verbose messages); a message above the threshold is dropped before it is copied to the UDP socket buffers.

Interfaces#

The Datarouter uses the interfaces provided by comp__mw_log_backend: Log Record Shared-Memory (logic_arc_int__logging__shared_memory) and Control Channel (logic_arc_int__logging__datarouter_msg_client).