Chronix

Examples

Runnable examples covering the embedded API, SQL and PromQL queries, forecasting, anomaly detection, streaming, and the cold tier.

On this page

Chronix ships a runnable example for every major feature. CI compiles and runs every one of them on each change, so they cannot drift away from the API they demonstrate.

Run any of them with:

cargo run -p chronix --example <name>

# `cold_tier` needs the object-store feature
cargo run -p chronix --features object-store --example cold_tier

Getting Started

ExampleDescription
basic_usageOpen a database, insert data points, and query them back
query_and_aggregationFluent QueryBuilder with aggregation, downsampling, and pruning statistics
sql_queriesSQL via DataFusion: GROUP BY, window functions, ORDER BY, LIMIT, UDFs
promql_queriesPromQL instant/range queries: rate(), avg_over_time(), label matching
exact_decimalsMeter registers a settlement is computed from, beside a 1 s float series: declaring a decimal column's scale, exact sums, and the write that is refused rather than rounded
schema_explorationIntrospect measurements, tag keys, field keys, columns, and schema registry

Analytics & Forecasting

ExampleDescription
forecastAll forecast models: Linear Regression, SES, Holt, Holt-Winters, ARIMA, SARIMA
anomaly_detectionAll anomaly methods: Z-Score, Modified Z-Score, IQR, Dynamic Threshold, Forecast Residual
continuous_forecastContinuous forecasting engine with accuracy tracking and automatic refit

Multivariate & Preprocessing

ExampleDescription
multivariate_analysisCross-series correlation, multivariate anomaly detection, PCA, and VAR forecasting
preprocessingGap detection, interpolation, smoothing, STL decomposition, resampling

Data Pipeline

ExampleDescription
data_pipelineCDC-driven real-time pipeline with triggers, alerts, streaming anomaly, and forecasting
alertingStreaming anomaly detection with threshold-based alerts and cooldown
signal_triggersTrigger engine with SQL triggers, delivery routing, and dead-letter queues

Storage & Operations

ExampleDescription
gateway_footprintThe small preset under the design partner's workload, printing the process's resident set at each step
storage_lifecycleManual flush, compaction, rollup materialisation, and retention enforcement
backup_and_restoreTake a checkpoint, verify it without restoring it, delete the original, and restore onto a fresh directory
delete_operationsTombstone-based deletes, predicate deletes, and measurement drops
encodingCompression codecs, adaptive encoding, and compression ratio comparison
compute_engineSIMD-accelerated computation, hardware tier detection, and buffer pool

Security & Multi-Tenancy

ExampleDescription
field_encryptionPer-column AES-256-GCM: declaring a column and its key variable, the ciphertext on disk, and the paths that refuse to write it out
encryptionThe standalone EncryptionService: key providers, round trip, and key rotation
authzCedar authorization: namespace and system decisions, a schema that refuses a misspelt action, and least-privilege administrative capabilities
audit_loggingStructured audit logging with multi-sink support and queryable audit trail
tenant_isolationNamespace management, quota enforcement, and resource usage tracking

Model Lifecycle

ExampleDescription
model_lifecycleModel registry, A/B testing, drift detection, and accuracy tracking

Recently added

ExampleDescription
quickstartThe program from the Getting Started page — open, write, query, close
quantile_forecastPrediction intervals from empirical residual quantiles, with conformal correction
cold_tierTiering segments to object storage as Hive-partitioned Parquet, and querying them with SQL (needs --features object-store)

Improve this page on GitHub