Grand Unified Log Strategy¶
Status: living spec. Owner repo: brinkhaustools (this repo ships the classes and
owns the wire schema). Created 2026-06-30.
This is the canonical contract for structured, self-describing status reporting
across all Brinkhaus tools. Every component that talks to the FleetManager via
brinkhaustools (Python, Rust, C++) reports status the same way; the FleetManager UI
renders it the same way. Repos that adopt it pin a brinkhaustools version; repos that
don't keep working unchanged (their values render as plain strings).
If you are an agent/dev picking this up: read this file top to bottom, then the "Phases" section tells you what to build and in what order. Real file references are given so you can jump straight to the code.
1. Why¶
The status snapshot is, today, opaque JSONB. Each StatusSource.get_status() returns
an arbitrary Dict[str, Any]; the FleetManager UI (SnapshotTree.vue) renders it
recursively with no idea what any leaf means:
- booleans show as
Ja/Neintext instead of a status lamp, - timestamps show as raw ISO strings instead of locale-formatted time,
- sizes/durations/percentages carry no unit and aren't formatted,
- labels can't be localized — the raw dict key is shown verbatim.
The samplingbackend component (datastore-v2) already emits richer leaves —
maxAge → {key, unit, label, value} — but the UI ignores the extra fields and just
shows them as four child rows. The metadata is already on the wire and unused. This spec
turns that into a real, generalized contract.
Out of scope — these are already solved and must NOT be folded in here:
- Host metrics (CPU/RAM/Disk min/avg/max table): a separate strongly-typed channel,
app.fleet.send_metrics([point])→ typedHostMetricEntrycolumns → dedicated formatters. Keep it. - Artifacts (downloadable log bundles): a separate channel,
app.fleet.send_artifact→ chunked/resumable upload → listed + downloadable. Keep it.
The Grand Unified Log Strategy concerns the status snapshot tree only.
2. The wire contract: a status-value leaf¶
A snapshot stays a JSON object of named sources, each source a JSON object/tree exactly as today. The only change: a leaf may be a status-value descriptor object instead of a bare scalar.
A descriptor extends the shape samplingbackend already emits and is detected by the
presence of a type field:
// leaf descriptor — recognized because it has "type"
"connected": {
"value": true,
"type": "bool",
"label": "status.logcollector.connected", // i18n key (optional)
"hint": "lamp" // display hint (optional)
},
"maxAge": {
"value": 90,
"type": "duration",
"unit": "days",
"label": "status.samplingbackend.maxAge"
}
Detection rule (normative)¶
A JSON object is a status-value descriptor iff it contains a string field type whose
value is one of the known types below. Anything else — a bare scalar, an array, or an
object without type — is rendered exactly as today (generic recursive tree, scalars via
the existing formatValue). This makes adoption purely additive and keeps all legacy
reporters working with zero changes (their leaves have no type, so they default to
strings).
Collision note: a legacy plain object that happens to have a
"type"string key would be misdetected. This is rare; the field nametypeis reserved by this spec going forward. If a real collision is found, the renderer additionally requires avaluefield to be present, which descriptors always have.
Fields¶
| Field | Required | Meaning |
|---|---|---|
value |
yes | The actual value (JSON scalar; for enum, the selected key). |
type |
yes | One of the type enum below. The detection marker. |
unit |
no | Unit string for sized/measured types (days, s, GB, %, °C, …). |
label |
no | i18n key (see §4). If absent, the dict key is used as the label. |
hint |
no | Display hint overriding the type default (see below). |
Type enum¶
bool, int, float, string, enum, timestamp (ISO-8601 → locale time),
duration (numeric + unit), bytes (numeric bytes → sized), percent (0–100),
temperature. Unknown type → fall back to string rendering (forward-compatible).
Hint enum (optional; each type has a sensible default)¶
lamp (bool → green/red indicator), badge, text, time, bytes, duration,
percent, gauge. Absent ⇒ derive from type (bool→lamp, timestamp→time,
bytes→bytes, duration→duration, percent→percent, else text).
Groups / nesting¶
Unchanged: nesting is just a normal JSON object whose children are descriptors and/or
further objects. No special group wrapper is needed (matches today's recursive tree). A
group may carry a sibling string field __label__ for an i18n group title; absent ⇒ the
object key is the title.
3. The producing API (brinkhaustools, all languages)¶
The shape above is the contract; these helpers just make it ergonomic and consistent.
Python (python/src/brinkhaustools/common/status.py)¶
Add a small value layer next to StatusSource:
@dataclass(frozen=True)
class StatusValue:
value: Any
type: str
unit: str | None = None
label: str | None = None # i18n key
hint: str | None = None
def to_wire(self) -> dict:
d = {"value": self.value, "type": self.type}
if self.unit: d["unit"] = self.unit
if self.label: d["label"] = self.label
if self.hint: d["hint"] = self.hint
return d
# convenience constructors
def boolean(value, *, label=None, hint="lamp") -> StatusValue: ...
def duration(value, unit="s", *, label=None) -> StatusValue: ...
def bytes_(value, *, label=None) -> StatusValue: ...
def percent(value, *, label=None) -> StatusValue: ...
def timestamp(iso, *, label=None) -> StatusValue: ...
def text(value, *, label=None) -> StatusValue: ...
A StatusSource.get_status() may return a dict mixing plain scalars and StatusValues.
The StatusEngine serializer walks the returned dict and calls to_wire() on any
StatusValue it finds (recursively through nested dicts/lists). Backward-compat: a
source returning only plain scalars serializes identically to today. This is the entire
contract — no StatusSource signature change, no forced migration.
Rust (
rust/src/status.rs) and C++ (brinkhauslib’sStatusSource) get the equivalent builders sosamplingbackendand Qt consumers emit the same envelope. The Rust/C++ emitters that already produce{key,unit,label,value}only need to addtype.
4. i18n¶
Label keys follow the existing FleetManager conventions
(frontend/src/utils/formatting.ts: software.{slug}, group.{name},
severity.{level}; missing key → fall back to the raw value). New namespace for status
leaves:
Translations live in brinkhausfleetmanager/frontend/src/i18n/{de,en}.json. A leaf with
no label renders its dict key verbatim (today's behavior).
5. The consuming side (FleetManager UI)¶
brinkhausfleetmanager/frontend/src/components/SnapshotTree.vue +
frontend/src/utils/snapshot.ts gain a descriptor branch:
parseSnapshotData/ the tree walker detects a descriptor leaf via the §2 rule.- A descriptor renders by
hint(default fromtype):lamp→ coloured indicator;time→formatTime(locale);bytes→formatBytes;duration/percent/unit→ number + unit; else text. Reuse the existing formatters infrontend/src/utils/formatting.ts. - The label is
t(descriptor.label)if present, else the dict key. - Anything not a descriptor renders exactly as today (generic recursion +
formatValue).
This is strictly additive: an un-upgraded UI shows descriptor fields as child rows (the
current samplingbackend behavior), so producers can ship before the UI lands.
6. Backward compatibility (explicit guarantees)¶
- Legacy
get_status()returning plainDict[str, Any](e.g.ideas4sbridgeviapythonuiapphelper, ~10 sites;bos-maintenanceHealthSnapshot) is unchanged: notypefield ⇒ string default ⇒ identical rendering.pythonappuihelperis not touched. - The status JSON schema (
test-fixtures/schemas/status.schema.json) keepssnapshotas a free-form object; no schema break. (Optionally add a$defs/statusValuefor documentation, but do not make itrequired.) - Wire is forward-compatible: unknown
type/hint→ string fallback.
7. Phases (foundation thin-slice first, then adopters)¶
Phase A — brinkhaustools Python StatusValue layer — DONE¶
StatusValuefrozen dataclass + classmethod constructors + recursive_serialise_treehook inpython/src/brinkhaustools/common/status.py, applied inStatusEngine.collect(); exported fromcommon/__init__(StatusValue,VALUE_TYPES).- Tests in
python/tests/test_status_value.py: wire form, every constructor type, recursion through nested dicts/lists, plain-only snapshot byte-identical to before, and engine-collect serialisation. 15 status tests green;mypy src/adds no errors. $defs/statusValuedocumented (non-required) instatus.schema.json. CHANGELOG Unreleased updated. (Version bump handled at release time per RELEASING.md.)
Phase B — FleetManager UI renderer — DONE¶
frontend/src/utils/snapshot.ts:isDescriptor(detect by knowntype+value),descriptorHint(type→default hint),isLamp/lampColor,descriptorLabel(i18n with fallback to the dict key),formatDescriptor(reusesformatTime/formatBytes; lamp→Ja/Nein, percent/duration/unit-aware).SnapshotTree.vue: descriptor branch placed before the generic-object branch (a descriptor is also an object), renders an mdi-circle lamp for booleans; everything non-descriptor renders exactly as before.status.logcollector.connectedseeded ini18n/{de,en}.json(namespacestatus.{slug}.{field}); Phase C extends it.- Tests
snapshot.spec.ts: 35 green;vue-tsc --noEmitclean.
Phase B½ — Consumer adoption audit — DONE (2026-06-30)¶
Full sweep of every brinkhaustools status consumer in the checked-out repos (..).
Result: zero consumers are adapted yet — Phases A/B built only the foundation
(producer API + UI renderer); no producer emits StatusValue leaves. The table below is
the authoritative rollout backlog. In-scope = pushes a status snapshot to the
FleetManager via brinkhaustools (directly, or through the pythonuiapphelper wrapper).
Out-of-scope = diagnosis-only (no StatusSource), or not a brinkhaustools fleet client.
| Consumer | Lang / path | Reports via | Current leaves | Adapted? | Phase |
|---|---|---|---|---|---|
| logcollector | Py / fleetmanager-logcollector |
brinkhaustools App |
plain scalars | no | C |
| samplingbackend (Rust) | Rust / datastore-v2 dsv2-status, dsv2-templates/retention.rs |
brinkhaustools crate | {key,unit,label,value} — missing type |
partial | D |
| samplingbackend (C++) | C++ / brinkhauslib DWSamplingStatusSource |
brinkhaustools C++ | plain nlohmann json | no | D |
| bos-maintenance (master) | Py / MainUI/health_monitor.py + MaintenanceSidecar/main.py |
brinkhaustools App |
~24 plain leaves | no — + source not registered | E |
| bos-maintenance-1.1 | Py / BrinkhausWebUI/MainUI/health_monitor.py |
brinkhaustools App (registered) |
plain leaves | no | E |
| datastore | Py / SystemInfo, InputSource(+subclasses) |
pythonuiapphelper → brinkhaustools |
float / str / dict | no | F (deferred) |
| dataviewer | Py / SystemInformation |
pythonuiapphelper → brinkhaustools |
int / float / dict | no | F (deferred) |
| ideas4sbridge | Py / ~10 getStatus() sites |
pythonuiapphelper |
plain scalars | no — stays string-default (decision) | — |
| pythonuiapphelper | Py adapter lib | wraps consumers' getStatus() verbatim |
passthrough | n/a — verify serialise routing | deferred (with F) |
Active rollout = C → D → E. The whole
pythonuiapphelperpath (Phase F: datastore + dataviewer, and the wrapper's serialise-routing check) is deferred by decision — the appuihelper is treated separately, later. It stays correct in the meantime because every unadapted leaf renders as a plain string.
Out of scope (confirmed):
- Diagnosis-only, no StatusSource (nothing to adapt): heartbeat, bos-usbservice,
bos-iolinkmasterproxy.
- Not brinkhaustools fleet clients (own/unrelated status code): Firmware_V11_Trunk
TPM-Logger (Java), UTTMProVisu (own C++ systemStatus framework),
claude-code-telegram-bh, fleetmanager-website.
Findings to act on:
1. bos-maintenance master never registers its HealthStatusSource (created at
health_monitor.py:133, no register_source in app.py) — its health snapshot does
not reach the fleet today. 1.1 registers it (app.py:1040). Fix the registration as
part of Phase E (it is a pre-existing gap, fixable sooner).
2. pythonuiapphelper is a transparent passthrough — _StatusSourceAdapter.get_status()
returns the legacy getStatus() verbatim, so a StatusValue flows through iff the
wrapper registers its sources into brinkhaustools' own StatusEngine.collect() (where
_serialise_tree runs). Verify this before Phase F; if it has its own collection loop,
add the same serialise hook there. No consumer-side change otherwise.
3. Version floors: adopters pin loose/old brinkhaustools (datastore ≥0.9.0,
dataviewer none, bos-maintenance ≥0.5.0 / 1.1 ≥0.4.0, pythonuiapphelper ≥0.2.1).
Each adopter must bump to the release carrying Phase A.
Phase C — logcollector adopts (reference implementation) — DONE¶
- New
fleetmanager_logcollector/status.pyLogCollectorStatusSource(a brinkhaustoolsStatusSource, nameLogCollector) emits descriptor leaves:docker_enabled(bool→lamp),metrics_interval/bundle_interval(duration,s),spool_used(bytes),spool_usage(percent),pending_bundles(int); all labelledstatus.logcollector.*. Registered inmain.pyviaapp.status.register_source(...)(the collector previously registered no custom source — only brinkhaustools built-ins). - Host metrics (
send_metrics) and bundles (send_artifact) stay separate, untouched. - brinkhaustools version is left at 0.16.0 — the StatusValue work is committed under
CHANGELOG
[Unreleased], no version bump. Cutting the release version + tag (which the adopter pins/tags will then move to) is the RELEASING.md action, done separately. - i18n
status.logcollector.*keys added in FleetManagerde/en.json. - Tests
tests/test_status.py(4): leaf types/labels, spool-fill reflection, end-to-end serialisation through the brinkhaustools engine.mypy --strictclean (15 files); pytest 42 passed. FleetManager frontend still 35 green /vue-tscclean. - First end-to-end proof of the whole stack.
Phase D — samplingbackend aligns (Rust + C++) — DONE (C++ pending a Qt build)¶
Corrected scope: the sources emitted plain scalar JSON (not the labelled
{key,unit,label,value} the screenshot implied — that tree isn't in the checked-out
source). So Phase D is a full plain→descriptor conversion, and the Rust/C++ crates needed a
StatusValue builder (they had none).
- brinkhaustools Rust (
rust/src/status.rs): addedStatusValue(derivesSerialize, embeds directly injson!); factoriesboolean/integer/number/text/enumeration/timestamp/duration/bytes/percent+.unit/.label/.hint; exported fromlib.rs. 10 status unit tests green (cargo test). - datastore-v2 (Rust):
dsv2_statusre-exportsStatusValue; all 11 status sources - both nested helpers (
RingMetrics/SinkMetrics) converted to descriptor leaves (bools→lamp, ratios→float, sizes→bytes, ms→duration, counters→int, states→enum). Updated the status-tree test assertions (now read["value"]).cargo check --workspaceclean; dsv2-source/dsv2-templates unit tests 26+10 green (built against local brinkhaustools via a path override +OPENSSL_NO_VENDOR=1).Cargo.tomlbrinkhaustools dep stays at tag 0.16.0 — move it to the tag that ships StatusValue once that release is cut. - brinkhaustools C++ (
cpp/src/status_value.h): header-onlyStatusValuemirror (implicitoperator nlohmann::json). - brinkhauslib C++
DWSamplingStatusSource: operational leaves converted (threadRunning/buffer.full→lamp,samplingRateMs→duration, sizes→int,status→enum; identity strings left plain). Not compiled here (no Qt) — build/verify steps inbrinkhauslib/docs/phase-d-cpp-statusvalue.md.
Phase E — bos-maintenance adopts (master + 1.1) — DONE¶
health_monitor.py(identical in both repos) now emits descriptor leaves via_snapshot_status/_url_status/_container_status:running/healthy/reachable→ bool/lamp;uptime_sec/check_duration_sec→duration(s);checked_at→timestamp;restart_count/status_code→int;status→enum; names/URLs/errors →string.HealthSnapshot.to_dict()kept plain (still feeds/api/health).- Finding #1 resolved: master's
HealthMonitorwas entirely dormant — now activated inapp.py __main__(register the source +start(interval_sec=30)) and/api/healthadded, mirroring 1.1. (1.1 was already wired.) - brinkhaustools floors left unchanged (versioning deferred to the release). i18n
status.bos-mainui.*keys added (de/en). - Tests updated in both repos; 31 pass each;
py_compileclean; FleetManagervue-tscclean. MaintenanceSidecar /api/status(master, versions/history) not yet wrapped — minor, left as a follow-up (it is a local REST endpoint, not the fleet snapshot).
Phase F — datastore + dataviewer adopt (via pythonuiapphelper) — DEFERRED¶
Deferred by decision (2026-06-30); the pythonuiapphelper layer is treated separately,
later. When picked up:
- Verify the pythonuiapphelper serialise routing (finding #2) first.
- Wrap getStatus() leaves: percentages → percent; GB/bytes sizes → bytes (or
float+unit); counts/queue depth → int.
- ideas4sbridge: left as-is (string default) — no work.
8. Cross-repo reference map¶
| Concern | Repo / file |
|---|---|
| Status engine + sources (Py) | brinkhaustools/python/src/brinkhaustools/common/status.py, app.py |
| Status engine (Rust) | brinkhaustools/rust/src/status.rs |
| Wire schema | brinkhaustools/test-fixtures/schemas/status.schema.json |
| Snapshot ingest (server) | brinkhausfleetmanager/middleware/src/routers/ingest.py, services/ingest_service.py |
| Snapshot render (UI) | brinkhausfleetmanager/frontend/src/components/SnapshotTree.vue, utils/snapshot.ts, utils/formatting.ts |
| i18n | brinkhausfleetmanager/frontend/src/i18n/{de,en}.json |
| samplingbackend leaves | datastore-v2/crates/dsv2-templates/src/retention.rs, brinkhauslib/.../RetentionManager.cpp |
| logcollector (1st adopter) | fleetmanager-logcollector/docs/deploy-targets-plan.md |
| Legacy string-default | ideas4sbridge via pythonuiapphelper getStatus(); bos-maintenance HealthSnapshot |
| Metrics (separate, keep) | fleetmanager-logcollector/src/.../metrics.py → send_metrics; UI HostMetricEntry |
| Artifacts (separate, keep) | send_artifact; brinkhausfleetmanager/middleware/src/routers/artifacts.py |