โ TL;DR
ChronoGraf is a high-performance, Java-based time series analytics platform backed by PostgreSQL.
It supports three complementary data modes:
- ๐ข Event Counters
- ๐ Aggregated Histograms
- ๐ Raw Events
Each is available across six fixed UTC-aligned temporal granularities:5s, 1m, 1h, 1d, 1w, 1mo.
With mixed-granularity querying, dynamic percentile calculation, and late event correction (via upward propagation), ChronoGraf provides scalable, accurate analytics for:
- Real-time dashboards
- Long-term trends
- SLA enforcement
- Compliance and audit use cases
It runs as a standalone REST service or embedded Java library, and is container-ready.
๐ Implementation Architecture
- Java 17
- Spring Boot + JPA/Hibernate
- Time series data stored in PostgreSQL
- Partitioned by time and metric key set
๐งฑ Deployment Modes
| Mode | Description |
|---|---|
| Standalone | REST-based microservice (Docker-supported) |
| Embedded | Drop-in Java module for Spring Boot projects |
โ
Includes: Dockerfile, docker-compose.yml, initdb/, and CLI tooling in scripts/.
๐ง Data Models and Storage Types
๐ข 1. Event Counters
- Tracks total number of events per time interval
- Efficient: 8 bytes per segment
- Granularities: all six
- Use cases: request count, error rate, transaction volume
โ
Late Event Handling
โ
In-place updates
โ
Upward rollups and cache invalidation
๐ 2. Aggregated Histograms ๐งญ
- Stores value distributions (e.g., latency, sizes)
- Bucketed using key-set-defined shapes: linear / exponential / custom
- Use cases: percentile queries, statistical summaries
โ
Dynamic percentile support
โ
Precomputed P50, P90, P95, P99 (optional per segment)
๐งญ Planned support for categorical histograms (e.g., status codes, error types)
๐ 3. Raw Events
- Stores full-resolution events with metadata and dimensions
- For forensic inspection, audit trails, deep filtering
- Immutable, append-only
๐๏ธ Granularity Strategy
| Granularity | Use Case |
|---|---|
| 5s | High-precision real-time |
| 1m | Operational dashboards |
| 1h | Mid-term trends |
| 1d | Daily summaries |
| 1w | Weekly aggregation |
| 1mo | Monthly / archival analysis |
โ All data aligned to these granularities for consistency and performance.
๐คค Mixed Granularity Querying ๐งญ
ChronoGraf uses a planner to minimize read costs while preserving boundary precision.
Example: Query from 21 Oct 13:30:25 โ 23 Oct 09:30:30
| Phase | Range | Granularity | Segments |
|---|---|---|---|
| Start boundary | 13:30:25 โ 13:31:00 | 5s | 7 |
| Hour fill | 13:31:00 โ 14:00:00 | 1m | 29 |
| Bulk segment | 14:00 โ 09:00 (2d) | 1h | 43 |
| End approach | 09:00 โ 09:30 | 1m | 30 |
| End boundary | 09:30:00 โ 09:30:30 | 5s | 6 |
๐ Total: 115 segments instead of 30,000+ (pure 5s scan)
๐ Percentile Support ๐งญ
โ Dynamic Percentile Calculation
- Arbitrary percentiles (P68, P99.7, etc.)
- Based on cumulative histogram with linear interpolation
โ ๏ธ P99.9+ requires โฅ1000 buckets for useful resolution
โ Precomputed Percentiles
- P50, P90, P95, P99 stored per segment
- Enables fast SLA dashboards and alerting
- Cached and available across all granularities
๐ ๏ธ Late Event Arrival & Fast Propagation ๐งญ
Late-arriving events are handled with accuracy:
- Routed to correct segment (5s/1m/etc.)
- Updates relevant buckets and counters
- Upward propagation (to 1h/1d/1w/1mo)
- Affected caches (e.g., percentiles) are invalidated and recomputed
โ
Implemented for event counters
๐งญ Partial for histograms
โ๏ธ Performance Optimizations
| Optimization | Description |
|---|---|
| ๐งญ Temporal delta encoding | Only changed buckets are stored |
| ๐งญ Sparse encoding | Skips zero-count buckets |
| Bucket shape reuse | Avoids duplicate metadata per segment |
| ๐งญ Parallel retrieval | Per-granularity fetch in parallel |
| In-memory aggregation | Efficient sum + percentile computation |
| ๐งญ Caching layers | Segment, shape, and aggregation caches |
Compression Ratios:
- Sparse data: 80โ90%
- Typical: 60โ70%
- Dense: 40โ50%
๐ Fault Handling
| Condition | Behavior |
|---|---|
| ๐งญ Bucket misalignment | โ Query rejected before execution |
| Partial segment loss | โ Partial results returned |
| ๐งญ Invalid percentiles | โ Clear validation errors |
| ๐งญ Counter overflow risk | โ Future-proofed via safe type enforcement |
๐ Monitoring & Metrics
ChronoGraf tracks system health and behavior:
- ๐งญ Query latency (in progress)
- ๐งญ Bucket alignment status
- ๐งญ Cache hit/miss ratios
- ๐งญ Late event handling metrics
- ๐งญ Granularity distribution usage
- ๐งญ Rollup propagation and recomputation latency
๐ Integration and Deployment
| Mode | Description |
|---|---|
| Standalone | Exposes REST API, runs in Docker or VM |
| Embedded | Spring Boot library โ plug in directly |
โ
Includes: Dockerfile, docker-compose.yml, initdb/, CLI tooling
๐ Use Case Scenarios
- Real-time dashboards (e.g., P95 latency per service/region)
- SLA enforcement with precomputed + dynamic percentiles
- Event auditing (by ID, timestamp, or field)
- Delayed pipelines with guaranteed correction
- High-volume metrics via event counters
- Executive summaries using 1w/1mo rollups
๐ข Multi-Tenant Identity & Distributed Tracing
ChronoGraf supports secure, isolated metric ingestion in multi-tenant deployments.
๐ Authentication Methods
| Method | Description |
|---|---|
| mTLS | Mutual TLS for trusted service communication |
| SPIFFE | Mesh-based identity (e.g., spiffe://org/...) |
| JWT | OAuth2 access tokens with tenant-scoped claims |
| BasicAuth | Legacy passkey credentials |
๐ Derived Context Fields
| Field | Purpose |
|---|---|
| Tenant ID | Enforces metric isolation |
| Service ID | Records the producer/consumer identity |
| Instance ID | Tags service instance (static/dynamic) |
Derived from: tokens, SPIFFE, mTLS certs.
๐ Parent Event ID Support
ChronoGraf supports distributed tracing via parent_event_id:
event-A
โโ event-A.1
โ โโ event-A.1.1
โโ event-A.2
๐ Use cases:
- Trace reconstruction
- Retry/failure lineage
- Async process visibility
๐ฑ Roadmap Features ๐งญ
- ๐งญ Categorical histograms (status codes, enums)
- ๐งญ Configurable bucket regeneration on schema change
- ๐งญ Counter overflow detection and throttling
- ๐งญ Segment-level TTL and archival support
- ๐งญ Enhanced UI dashboards for histogram visualizations
ChronoGraf is scalable, observable, secure, and ready for the future.
Whether you need real-time metrics, forensic traceability, or executive-level rollups โ ChronoGraf delivers.