Skip to content

bench | timeseries: JSON API, Grafana datasource plugin, ci-bench-timeseries profile#6562

Draft
Russoul wants to merge 5 commits intomasterfrom
russoul/timeseries-align-http-api-with-prometheus
Draft

bench | timeseries: JSON API, Grafana datasource plugin, ci-bench-timeseries profile#6562
Russoul wants to merge 5 commits intomasterfrom
russoul/timeseries-align-http-api-with-prometheus

Conversation

@Russoul
Copy link
Copy Markdown
Contributor

@Russoul Russoul commented May 6, 2026

Summary

  • POST /timeseries/query now returns JSON — a new Cardano.Timeseries.JSON module adds ToJSON instances for Value, Instant, Timeseries, and SeriesIdentifier; the server switches from plain-text to application/json responses
  • ci-bench-timeseries workbench profile — 2-node local cluster with the timeseries HTTP endpoint enabled on port 3400, no shutdown condition (runs until manually stopped), make ci-bench-timeseries-auto to start
  • Grafana datasource plugin (bench/grafana-datasource/) — TypeScript frontend plugin that queries the timeseries server via Grafana's server-side proxy and converts Value JSON to Grafana DataFrame[]; docker compose up -d starts a pre-configured Grafana instance at http://localhost:3001
  • Nix wiringtracer.nix, cardano-tracer-service-workbench.nix, and cardano-tracer-service.nix all gain a timeseries/hasTimeseries option to enable the endpoint
  • macOS fixsupervisor.sh replaces netstat -pltn (hangs on macOS) with lsof -nP -iTCP:9001 -sTCP:LISTEN

Russoul added 5 commits May 7, 2026 00:16
…eseries profile

**cardano-tracer / cardano-timeseries-io**
- Add `Cardano.Timeseries.JSON` with `ToJSON` instances for `Value`, `Instant`,
  `Timeseries` and `SeriesIdentifier` (orphan module, imported for side-effects)
- Switch `POST /timeseries/query` response from plain text to `application/json`

**cardano-profile**
- Add `timeseries :: Bool` field to `Tracer`
- Add `tracerTimeseries` primitive
- Add `ci-bench-timeseries` profile: 2-node local cluster with timeseries endpoint
  enabled, no shutdown condition, generator runs for 100 000 epochs (effectively
  indefinite) — intended for interactive exploration via Grafana
- Regenerate `all-profiles-coay.json` and `wb_profiles.mk`; update all test fixtures

**Nix**
- `cardano-tracer-service-workbench.nix`: add `timeseries` option → `hasTimeseries`
- `cardano-tracer-service.nix`: add `timeseriesEnable/Host/Port` NixOS options
- `tracer.nix`: wire `profile.tracer.timeseries` → `{epHost, epPort = 3400}`
- `supervisor.sh`: replace hanging `netstat -pltn` with `lsof -nP -iTCP:9001
  -sTCP:LISTEN` for macOS compatibility

**bench/grafana-datasource** (new)
- TypeScript Grafana datasource plugin (`iog-cardanotimeseries-datasource`)
- Sends `POST /timeseries/query` via Grafana server-side proxy (avoids CORS)
- Converts `Value` tagged-union JSON to Grafana `DataFrame[]`
- `docker-compose.yaml` for local development; datasource auto-provisioned at
  `http://host.docker.internal:3400`; Colima-compatible (`extra_hosts`)
- Parse/eval errors from the server are now surfaced as DataQueryError:
  the banner shows the first line (summary); the full multi-line message
  (source location + caret) is in data.message for the inspector
- Requests go via Grafana's server-side proxy (instanceSettings.url) to
  avoid CORS and host-resolution issues in the browser
- Add Unit value: renders as an empty frame (no data to display)
- POST /timeseries/query now accepts JSON body {"query": "...", "time": <optional Unix seconds>}
- Success response wrapped in {"status":"success","data":...} envelope
- Error responses use {"status":"error","errorType":"...","error":"..."} format
- errorType mirrors Prometheus: "parse", "bad_data", "execution"
- Plugin updated to send application/json body and unwrap response envelope
- Remove ConfigEditor.tsx (Grafana's built-in URL field suffices)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant