hyprstream_metrics_api/lib.rs
1//! Metrics API: public types, schemas, and storage-abstract stores.
2//!
3//! This crate is the library half of the metrics substrate (Apache-2.0):
4//! - Schema-v2 [`metrics::MetricRecord`] with labels and tenant id
5//! - [`metrics::producer::MetricsProducer`], the producer-side write API
6//! - [`metrics::calibration::CalibrationStore`]: versioned, append-only
7//! calibration parameter rows keyed by (primitive, schema, model, calib
8//! version)
9//! - [`metrics::decision_batch::DecisionBatchStore`]: Arrow-native decision
10//! batches keyed by schema fingerprint
11//! - The [`storage::StorageBackend`] trait and view/aggregation types the
12//! stores and the serving engine share.
13//!
14//! DuckDB/DataFusion engine implementations live in the `hyprstream-metrics`
15//! crate behind these traits; the default serving shape is two-process, so
16//! consumers link only this API crate.
17
18pub mod aggregation;
19pub mod metrics;
20pub mod storage;
21
22pub use aggregation::{AggregateFunction, AggregateResult, GroupBy, TimeWindow};
23pub use metrics::calibration::{
24 calibration_params_schema, mint_calib_version, CalibrationParams, CalibrationStore,
25 ConformalParams, ConformalQuantile, DecisionPrimitive, DirichletParams, OrdinalInterval,
26 VersionTriple, CALIBRATION_TABLE,
27};
28pub use metrics::decision_batch::{
29 decision_batch_schema, mint_batch_id, DecisionBatchMeta, DecisionBatchStore,
30 DECISION_BATCH_TABLE,
31};
32pub use metrics::producer::MetricsProducer;
33pub use metrics::{create_schema_v2_tables, MetricRecord, METRICS_SCHEMA_VERSION, METRICS_TABLE};
34pub use storage::StorageBackend;
35
36// Re-export Arrow so API consumers name the exact types the stores exchange.
37pub use arrow;