Examples
Thirty-plus runnable Chronix programs, from a quickstart to a year on a gateway: forecasting, detection, pipelines, security, storage.
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
| Example | Description |
|---|---|
| readme | The README's program: write a morning of solar output, aggregate it with SQL, forecast the next ten minutes |
| basic_usage | Open a database, insert data points, and query them back |
| query_and_aggregation | Fluent QueryBuilder with aggregation, downsampling, and pruning statistics |
| sql_queries | SQL via DataFusion: GROUP BY, window functions, ORDER BY, LIMIT, UDFs |
| promql_queries | PromQL instant/range queries: rate(), avg_over_time(), label matching |
| exact_decimals | Meter 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_exploration | Introspect measurements, tag keys, field keys, columns, and schema registry |
Analytics & Forecasting
| Example | Description |
|---|---|
| forecast | All forecast models: Linear Regression, SES, Holt, Holt-Winters, ARIMA, SARIMA |
| anomaly_detection | All anomaly methods: Z-Score, Modified Z-Score, IQR, Dynamic Threshold, Forecast Residual |
| declared_detector | A PV plant-health monitor the store keeps: a quarter-hour performance ratio judged against the same quarter hour on the Berlin wall clock, a simulated year across both clock changes, a 15 % degradation caught within hours |
| continuous_forecast | Continuous forecasting engine with accuracy tracking and automatic refit |
Multivariate & Preprocessing
| Example | Description |
|---|---|
| multivariate_analysis | Cross-series correlation, multivariate anomaly detection, PCA, and VAR forecasting |
| preprocessing | Gap detection, interpolation, smoothing, STL decomposition, resampling |
Data Pipeline
| Example | Description |
|---|---|
| data_pipeline | CDC-driven real-time pipeline with triggers, alerts, streaming anomaly, and forecasting |
| alerting | Streaming anomaly detection with threshold-based alerts and cooldown |
| signal_triggers | Trigger engine with SQL triggers, delivery routing, and dead-letter queues |
Storage & Operations
| Example | Description |
|---|---|
| gateway_footprint | The small preset under the design partner's workload, printing the process's resident set at each step |
| storage_lifecycle | Manual flush, compaction, rollup materialisation, and retention enforcement |
| backup_and_restore | Take a checkpoint, verify it without restoring it, delete the original, and restore onto a fresh directory |
| delete_operations | Tombstone-based deletes, predicate deletes, and measurement drops |
| encoding | Compression codecs, adaptive encoding, and compression ratio comparison |
| compute_engine | SIMD-accelerated computation, hardware tier detection, and buffer pool |
Security & Multi-Tenancy
| Example | Description |
|---|---|
| field_encryption | Per-column AES-256-GCM: declaring a column and its key variable, the ciphertext on disk, and the paths that refuse to write it out |
| encryption | The standalone EncryptionService: key providers, round trip, and key rotation |
| authz | Cedar authorization: namespace and system decisions, a schema that refuses a misspelt action, and least-privilege administrative capabilities |
| audit_logging | Structured audit logging with multi-sink support and queryable audit trail |
| tenant_isolation | Per-namespace series quotas admitted by the engine: a refused batch, exact usage, headroom released by a delete |
Model Lifecycle
| Example | Description |
|---|---|
| model_lifecycle | Model registry, A/B testing, drift detection, and accuracy tracking |
Recently added
| Example | Description |
|---|---|
| quickstart | The program from the Getting Started page — open, write, query, close |
| quantile_forecast | Prediction intervals from empirical residual quantiles, with conformal correction |
| cold_tier | Tiering segments to object storage as Hive-partitioned Parquet, and querying them with SQL (needs --features object-store) |
Edit this page on GitHub · Updated