Rust-native storage engine backend for TimelessMetrics.
Handles the hot path for raw point writes and queries through a single Rust NIF resource. The Elixir application still owns supervision, HTTP routing, alerts, annotations, scrape targets, and rollup metadata.
Started as a child of the store's supervisor. The engine reference is stored in persistent_term for zero-cost access on the hot path.
Summary
Functions
Returns a specification to start this module under a supervisor.
Force a compaction pass: merge raw and undersized chunks older than
cutoff_ts into large pco chunks (:all compacts regardless of age).
Runs automatically on the cold-flush timer when the store uses
defer_compression: true, sparing the last hour so narrow recent
queries stay on small chunks. Returns {:ok, series, chunks_replaced}.
Fused Prometheus ingest: parse exposition text and write all samples in a
single NIF call — no per-sample terms cross the boundary. Samples without
a timestamp get default_ts (epoch seconds).
Latest point per series matching a label filter, regardless of age.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Force a compaction pass: merge raw and undersized chunks older than
cutoff_ts into large pco chunks (:all compacts regardless of age).
Runs automatically on the cold-flush timer when the store uses
defer_compression: true, sparing the last hour so narrow recent
queries stay on small chunks. Returns {:ok, series, chunks_replaced}.
Fused Prometheus ingest: parse exposition text and write all samples in a
single NIF call — no per-sample terms cross the boundary. Samples without
a timestamp get default_ts (epoch seconds).
Returns {:ok, count, errors} where count is samples written and errors
is malformed line count. Note: labels are stored exactly as scraped; no
relabeling is applied. Callers needing relabel rules must use
PrometheusNif.parse/1 + write_batch/2 instead.
Latest point per series matching a label filter, regardless of age.
The NIF has no dedicated latest-point query yet, so this reads the full range and keeps the newest sample per series.