monitor.store¶
MetricStore — the monitor’s in-memory time-series and event state.
Series are keyed "hostname/label" (bare label for historical imports
without a host column). Extracted from MetricCollector; the id-assignment
quirk in add_event is deliberately preserved (see test_store.py).
- class otto.monitor.store.MetricStore¶
Bases:
objectIn-memory series, chart map, and events for one collector.
- append_point(key: str, point: MetricPoint, *, label: str, chart: str) None¶
Store one point, creating the series lazily, and record its chart group.
- append_log_event(host: str, tab: str, event: LogEvent) None¶
Store one log-event row in the per-(host, tab) ring (oldest drop at capacity).
- snapshot_log_events() list[tuple[str, str, LogEvent]]¶
Return every ring’s rows as (host, tab, event) triples, insertion-ordered per ring.
- snapshot_series() dict[str, list[MetricPoint]]¶
Return a copy of every series, safe for a caller to mutate.
- events() list[MonitorEvent]¶
Return a copy of all recorded events in insertion order.
- find_event(event_id: int) MonitorEvent | None¶
Return the event with this id, or
Noneif it is not tracked.
- add_event(event: MonitorEvent, rowid: int) MonitorEvent¶
Assign the id (DB rowid wins; the counter advances regardless) and store.
- note_imported_event(event: MonitorEvent) None¶
Track an event loaded from a file, keeping the id counter ahead of it.