Chronix

Connect Grafana

Use Chronix as a Prometheus or Flight SQL data source in Grafana, import the bundled dashboards, and add annotations and alerts.

On this page

Chronix integrates natively with Grafana through multiple data source types. This guide covers setup, dashboard provisioning, and best practices.

Data Source Options

Data SourceProtocolBest For
PrometheusHTTP (PromQL)Real-time metrics, alerting
Flight SQLgRPC (Arrow)High-throughput analytics, large result sets
InfinityHTTP RESTCustom JSON queries, admin views

Chronix serves the Prometheus HTTP API at the paths a Prometheus client derives from a base URL, so the data source needs nothing but the server's address.

Add Data Source

  1. Navigate to Grafana → Connections → Data Sources → Add data source
  2. Select Prometheus
  3. Configure:
FieldValue
URLhttp://chronix.example.com:8086
AccessServer (default)
Scrape interval15s
  1. Click Save & Test — should show "Data source is working"
Grafana Explore with the Chronix data source selected, running avg_over_time(pv_power_w[15m]) and drawing two days of solar output
Explore against chronixd --demo: a PromQL query answered by Chronix itself, no Prometheus in between.

Custom Headers (Authentication)

If Chronix authentication is enabled:

  • Under Custom HTTP Headers, add:
    • Header: Authorization
    • Value: Bearer <your-api-key>

For multi-tenant deployments, also add:

  • Header: X-Namespace
  • Value: <namespace>

Metric names

A Chronix measurement holds several fields; a PromQL metric holds one value. The metric name is <measurement>_<field> — except that a field named value gives the measurement name alone, which is how Prometheus remote write and OTLP store a sample, so scraped metrics keep their names.

So cpu,host=a usage=42,load=0.7 is queried as cpu_usage and cpu_load, not as cpu. Adding a field to a measurement never renames the metrics already there.

The metric browser lists every stored metric. The one exception is a histogram's classic names — foo_bucket, foo_count, foo_sum — which answer when typed but are not listed, so that {__name__=~".+"} cannot return the same observations three times over.

Histogram panels

A native histogram is one metric, not a family, so a percentile needs no rate() over a bucket series:

histogram_quantile(0.99, http_latency)    # native
histogram_avg(http_latency)
histogram_fraction(0, 0.25, http_latency) # share under 250 ms

For a heatmap panel, query the classic view and set Format to Heatmap — Grafana reads the le labels as it always has:

http_latency_bucket
A Grafana dashboard with four panels — PV power, grid import, battery state of charge and heat pump power — over two days of demo data
Ordinary Grafana panels on the demo’s data; every query is PromQL served by Chronix.

PromQL Examples

# CPU usage rate per host
rate(cpu_usage{host=~"server-.*"}[5m])

# 95th percentile query latency
histogram_quantile(0.95, rate(query_duration_seconds_bucket[5m]))

# Active series count
chronix_series_count

# ingestion rate
rate(chronix_points_written_total[1m])

A panel says "No data"

Open the panel's query inspector: when the query is probably misspelt, the response's warnings name the metric or label that was meant. To see which matcher emptied the result, run the query against /api/v1/query with explain_empty=true:

curl -G localhost:8086/api/v1/query --data-urlencode 'explain_empty=true' --data-urlencode 'query=http_requests_total{job="api", code=~"5.."}'

2. Flight SQL Data Source

For analytical queries returning large Arrow tables.

Prerequisites

Install the Grafana Flight SQL plugin:

grafana-cli plugins install grafana-flightsql-datasource

Configuration

FieldValue
Hostchronix.example.com:8817
Securefalse (or true with TLS)
Auth Typenone / token

SQL Examples

-- Top 10 hosts by CPU usage in the last hour
SELECT host, AVG(usage) AS avg_usage
FROM cpu
WHERE _time > now() - INTERVAL '1 hour'
GROUP BY host
ORDER BY avg_usage DESC
LIMIT 10;

-- Rows per measurement in the last hour
SELECT COUNT(*) AS rows
FROM cpu
WHERE _time > now() - INTERVAL '1 hour';

3. Pre-Built Dashboards

Six Grafana dashboards ship in dashboards/ and inside the binary (chronixd --export-dashboards DIR):

DashboardFileDescription
Cluster Overviewcluster-overview.jsonNode health, Raft state, replication lag — for the frozen cluster tier only
Ingestioningestion.jsonWrite throughput, batch sizes, WAL depth
Query Performancequery-performance.jsonQuery and write latency percentiles, throughput, plan- and scan-cache hit ratios, segment pruning
Storagestorage.jsonSegment counts, compaction stats, disk usage
Analyticsanalytics.jsonForecasting models, anomaly detections
Signalssignals.jsonSignal triggers, alert firings

These dashboards read Chronix's own metrics, so they need a Prometheus server scraping http://<host>:8086/metrics — not the Chronix data source from section 1, which serves the series you wrote. Use both in one Grafana: section 1's data source for your data, a second one for these.

Cluster Overview needs the chronixd-cluster binary; chronixd does not emit cluster metrics.

A metric that has never been recorded is absent from a scrape, so Grafana draws "No data". Write-path counters read 0 from startup; feature-gated panels — object-store tiering, signal channels, analytics latencies — stay empty until that feature is configured and used.

The bundled Ingestion dashboard: ingestion rate, write latency percentiles, WAL size, memtable flushes, active series, measurements, batch sizes and ingestion errors
Ingestion, read from a Prometheus scraping /metrics.
The bundled Query Performance dashboard: query and write latency percentiles, query and write throughput, batch size, plan- and scan-cache hit ratios and segments pruned
Query Performance: latency percentiles, throughput, cache hit ratios and how many segments pruning skipped.

Manual Import

  1. Navigate to Grafana → Dashboards → Import
  2. Upload the JSON file from dashboards/
  3. Select your Chronix Prometheus data source
  4. Click Import

Provisioning (Automated)

For automated deployments, use Grafana provisioning:

/etc/grafana/provisioning/datasources/chronix.yaml:

apiVersion: 1

datasources:
  - name: Chronix
    type: prometheus
    access: proxy
    url: http://chronix:8086
    isDefault: true
    jsonData:
      httpMethod: POST
      timeInterval: "15s"

/etc/grafana/provisioning/dashboards/chronix.yaml:

apiVersion: 1

providers:
  - name: chronix
    type: file
    disableDeletion: false
    updateIntervalSeconds: 60
    options:
      path: /var/lib/grafana/dashboards/chronix
      foldersFromFilesStructure: true

Copy the dashboard JSON files. Each dashboard has a Data source selector; it starts on the default Prometheus data source, so pick the one that scrapes Chronix's /metrics, or open the dashboard with ?var-datasource=<uid>:

cp dashboards/*.json /var/lib/grafana/dashboards/chronix/

Docker Compose Example

services:
  chronix:
    image: chronix:latest
    ports:
      - "8086:8086"   # HTTP + Prometheus
      - "8087:8087"   # gRPC
      - "8817:8817"   # Flight SQL

  grafana:
    image: grafana/grafana:13.3.1
    ports:
      - "3000:3000"
    volumes:
      - ./dashboards:/var/lib/grafana/dashboards/chronix:ro
      - ./grafana/provisioning:/etc/grafana/provisioning:ro
    environment:
      GF_SECURITY_ADMIN_PASSWORD: admin

4. Annotations

Chronix supports Grafana annotations for overlaying events on time-series panels.

REST Endpoint

GET /api/v1/annotations?from=<start_ns>&to=<end_ns>&measurement=<name>

SSE Stream

For live annotations:

GET /api/v1/annotations/stream

Configure in Grafana using the Annotations panel settings.

5. Alerting

Use Grafana Alerting with the Prometheus data source:

  1. Create an Alert Rule using PromQL
  2. Set the data source to your Chronix Prometheus source
  3. Configure notification channels (Slack, PagerDuty, etc.)

Example alert: CPU usage above 90% for 5 minutes

avg by (host) (rate(cpu_usage[5m])) > 0.90

6. CDC Live Dashboard (SSE)

Chronix supports Server-Sent Events for real-time change data capture:

GET /api/v1/cdc/stream

Use the Grafana Live feature or a streaming panel plugin to display real-time writes as they happen.

Edit this page on GitHub · Updated

Esc