Skip to main content

Crate chronix

Crate chronix 

Source
Expand description

§Chronix

The embedded-first time-series database with analytics built in.

One dependency gives you a crash-safe, columnar time-series engine with SQL (DataFusion), PromQL, forecasting and anomaly detection — in process, no server, no sidecar. The same engine runs as the chronixd server behind Grafana, Prometheus and Telegraf.

§Quick start

use chronix::prelude::*;

let db = Chronix::open_small("/tmp/mydb")?;

let key = SeriesKey::new("cpu", tags! { "host" => "server-01" })?;
let point = Point::new(key, fields! { "usage" => 95.5 }, 1_700_000_000_000_000_000)?;
db.insert(&point)?;

for batch in db.sql("SELECT host, avg(usage) FROM cpu GROUP BY host")? {
    println!("{batch:?}");
}
db.close()?;

§Where things are

§Stability

Three tiers, and the difference matters when a dependency bumps:

  1. Chronix, prelude and the types they name — the supported surface. Arrow’s RecordBatch is the only third-party type in it, and deliberately so: a columnar database that hides its batches is a database you cannot stream out of.
  2. sql and promql — for callers who want more than Chronix::sql and Chronix::promql offer. sql takes and returns DataFusion types, so it moves when DataFusion does.
  3. The re-exported engine crates — no promise beyond their own.

Within 0.x none of this is frozen; a breaking change bumps the minor (CONTRIBUTING.md). public_api pins the tier-1 surface so that a change to it is a deliberate edit rather than a side effect.

What actually changed in a release is in the changelog. The link is absolute and it is here, on the crate’s own front page, because this is the page a reader lands on after cargo update moved them a minor version. There is one changelog and it lives at the repository root: cargo package includes nothing from outside a package directory, so a copy inside this crate would be a second changelog to keep true rather than a copy that stays true.

Re-exports§

pub use analytics::AnomalyConfig;
pub use analytics::ForecastConfig;
pub use db::BackupManifest;
pub use db::Chronix;
pub use db::DatabaseStatistics;
pub use db::SegmentInfo;
pub use delete::DeleteBuilder;
pub use delete::DeleteOutcome;
pub use delete::DeleteRequest;
pub use error::DbError;
pub use error::InsertResult;
pub use export::ParquetCompression;
pub use export::ParquetExportConfig;
pub use pipeline::Pipeline;
pub use pipeline::PipelineConfig;
pub use rollup::RollupAggFn;
pub use rollup::RollupBuilder;
pub use rollup::RollupConfig;
pub use rollup::RollupRegistry;
pub use rollup::RollupState;
pub use chronix_analytics;
pub use chronix_core;
pub use chronix_encoding;
pub use chronix_engine;
pub use chronix_query;
pub use chronix_security;
pub use chronix_streaming;

Modules§

analytics
Analytics configuration types for the Rust API. Configuration types for the Chronix analytics Rust API.
cold_archive
Archiving cold data to object storage.
db
The Chronix database handle — open, write, query, close lifecycle.
delete
Fluent delete builder for predicate-based deletes.
error
Unified error type for the Chronix embedded database.
export
Parquet export — converts Chronix segments to Apache Parquet files.
macros
Convenience macros for building tags and fields.
pipeline
Real-time analytics pipeline — orchestrates CDC → Signal, Analytics, Authz, and Audit.
prelude
Everything a typical program needs: use chronix::prelude::*;.
promql
PromQL query engine for Chronix.
retention
Retention enforcer — automatically drops shards older than the retention period.
rollup
Rollup configuration, the streaming bucket accumulator, and the materialisation watermarks.
sql
SQL query engine powered by Apache DataFusion.

Macros§

fields
Build a BTreeMap<String, FieldValue> of fields.
tags
Build a BTreeMap<String, String> of tags.