Skip to content

store

diapason.telemetry.store

SQLite-backed telemetry storage.

TelemetryStore

Append-only SQLite store for inference telemetry records.

Writes are batched in memory and flushed to SQLite when a batch reaches batch_size, when flush_interval_seconds elapses (a background flusher thread guarantees this even with no further writes), on any read through this store, and on close(). Readers that open their OWN connection to the database file (e.g. TelemetryAggregator) therefore see new rows within flush_interval_seconds at the latest; call flush() first for immediate visibility. Pass flush_interval_seconds=0 to disable time-based flushing (batch-size and read/close flushes still apply).

close()

Flush pending records and close the underlying SQLite connection.

flush()

Write all pending records to the database.

list_recent(limit=50)

Return recent telemetry rows as dictionaries.

list_recent_mining_stats(limit=50)

Return recent mining stats snapshots as dictionaries.

record(rec)

Persist a single telemetry record.

record_mining_stats(stats)

Persist one mining stats snapshot.

stats is duck-typed to keep telemetry usable without importing the optional mining package at module import time.

subscribe_to_bus(bus)

Subscribe to TELEMETRY_RECORD events on bus.