Why tsink?
- Three deployment modes — embed the library directly in your Rust or Python application, run a standalone server binary, or form a replicated cluster. Same engine everywhere.
- Robust engine — segmented WAL with crash-safe sync, LSM-style leveled compaction, adaptive delta/XOR/zstd encoding, mmap zero-copy reads, and configurable memory backpressure.
- Tiered storage — hot, warm, and cold tiers with automatic lifecycle management and optional object-store backing.
- Drop-in protocol support — accepts Prometheus remote write/read, InfluxDB line protocol, OTLP, StatsD, and Graphite out of the box.
- Built-in PromQL — query your data with a native PromQL parser and evaluator. No external query layer needed.
- Secure by default — TLS (rustls, no OpenSSL), RBAC with OIDC, multi-tenant isolation, and mTLS between cluster nodes.
- Zero external dependencies at runtime — single static binary for the server;
protocis vendored at build time.
Deployment modes
Embedded library
Add tsink as a dependency and get a full time-series engine in-process — WAL durability, compaction, retention, and queries included.
use ;
UniFFI bindings expose the core API as a native Python module:
=
=
Server mode
A single binary that speaks every major metrics protocol.
Write data with any client you already have:
# Prometheus text exposition
# PromQL query
Cluster mode
Enable clustering with a flag and scale horizontally. tsink handles shard routing, replication, consistency, hinted handoff, repair, and rebalance automatically.
Storage engine
| Capability | Details |
|---|---|
| Durability | Segmented WAL with configurable sync — per-append (crash-safe) or periodic (throughput-optimized). Strict or salvage replay on recovery. |
| Compaction | LSM-style leveled compaction (L0 → L1 → L2) with tombstone-aware merging and atomic segment replacement. |
| Tiered storage | Automatic hot → warm → cold lifecycle with configurable retention windows. Object-store backing for warm/cold tiers. |
| Encoding | Adaptive timestamp codecs (fixed-step, delta-varint, delta-of-delta), Gorilla XOR float compression, and zstd for persisted segments. |
| Data types | float64, bytes, and native Prometheus histograms. |
| Memory control | Configurable memory budget with admission-based backpressure. Cardinality limits on unique series. |
| Reads | mmap-based zero-copy segment reads. Downsampling, aggregation, and regex-capable label matchers built in. |
Ingestion protocols
| Protocol | Endpoint | Notes |
|---|---|---|
| Prometheus Remote Write | POST /api/v1/write |
Snappy-framed protobuf |
| Prometheus Remote Read | POST /api/v1/read |
|
| Prometheus Text Exposition | POST /api/v1/import/prometheus |
Bulk import |
| InfluxDB Line Protocol | POST /write, POST /api/v2/write |
v1 and v2 compatible |
| OTLP HTTP | POST /v1/metrics |
Protobuf; gauges, sums, histograms, summaries |
| StatsD | UDP (--statsd-listen) |
Counter, gauge, timer, set |
| Graphite | TCP (--graphite-listen) |
Plaintext protocol |
Clustering & replication
- Consistent hash-ring sharding with configurable shard count
- Tunable replication factor and consistency levels (One / Quorum / All) for writes and reads
- Node roles — dedicated Storage, Query, or Hybrid nodes
- Hinted handoff — queues writes for temporarily unavailable replicas
- Digest-based repair — fingerprint exchange detects and resolves inconsistencies
- Online rebalance — pause, resume, and monitor shard migration
- Distributed query fan-out — concurrent shard-aware reads with merge limits
- Cluster-wide snapshots — coordinated data + control-plane backup and restore
- Internal mTLS — dedicated CA for peer-to-peer traffic
Security & multi-tenancy
- TLS — rustls-based with hot-reloadable certificates
- Authentication — bearer tokens (file or exec-based loading), OIDC JWT validation (RS256, HS256)
- RBAC — roles, service accounts with rotation, and live audit logging
- Multi-tenant isolation — per-tenant policies for write rate, query concurrency, admission budgets, and retention
- Secret rotation — runtime rotation of auth tokens, TLS certs, and mTLS materials with overlap grace periods
Operations
/healthzand/ready— Kubernetes-compatible probes/metrics— Prometheus-format self-instrumentation- Recording & alerting rules — built-in rules engine with configurable evaluation intervals
- Rollup policies — persistent downsampled materialization with automated scheduling
- Migration tooling — backfill, verify, and cutover from Prometheus, VictoriaMetrics, InfluxDB, OTLP, StatsD, and Graphite
- Support bundles — bounded JSON diagnostic snapshots per tenant
Documentation
Getting started
- Embedded library guide — using tsink as a Rust dependency,
StorageBuilderconfiguration, sync and async APIs, snapshots - Python bindings guide — UniFFI setup,
TsinkStorageBuilder, type mappings, error handling - Server deployment — running the single-node server binary, CLI flags, environment variables
- Cluster setup — multi-node deployment, peer discovery, shard count, replication factor, consistency levels, node roles
Architecture & design
- Architecture overview — high-level system design, component interactions, data flow
- Storage engine internals — WAL, segments, LSM-style compaction, encoding codecs, mmap reads, write buffer
- PromQL implementation — lexer, parser, evaluator, supported functions, aggregations, subqueries
- Clustering internals — consistent hash ring, replication protocol, hinted handoff, digest repair, rebalance, distributed queries
API & protocol reference
- HTTP API reference — all endpoints, request/response formats, authentication headers, error codes
- PromQL reference — function catalogue, operators, vector matching, type coercion rules
- Ingestion protocols — Prometheus remote write, InfluxDB line protocol, OTLP, StatsD, Graphite wire formats and endpoints
- Configuration reference — complete list of server, engine, cluster, and security options with defaults
Features
- Tiered storage — hot/warm/cold lifecycle, retention windows, object-store backing
- Compaction — L0/L1/L2 levels, merge strategies, tombstone handling, tuning
- Rollups & downsampling — rollup policies, materialization scheduling, query integration
- Data types & native histograms — float64, bytes, native histograms, timestamp precision modes
- Exemplars — exemplar storage, querying, cardinality limits
Security & operations
- Security model — TLS/mTLS setup, RBAC roles, OIDC authentication, audit logging
- Multi-tenancy — tenant isolation, per-tenant quotas, admission budgets, usage accounting
- Secret rotation — rotating auth tokens, TLS certificates, mTLS materials, grace periods
- Monitoring & observability —
/metricsendpoint, self-instrumentation, health probes, support bundles - Recording & alerting rules — rule definitions, evaluation intervals, recording rule output
- Performance tuning — memory budgets, compaction tuning, write pipelining, cgroup-aware scheduling
- Migration guide — migrating from Prometheus, VictoriaMetrics, InfluxDB; backfill, verify, cutover
License
MIT — see LICENSE.