Time Series Data
The time series endpoint returns structured time series data suitable for rendering charts and dashboards in the frontend.
Endpoint
GET /v1/analytics/time-seriesQuery Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
days | int | 7 | Number of days of data |
granularity | String | hour | Time bucket: hour, day, week |
curl Example
curl "http://query-engine:8080/v1/analytics/time-series?days=7&granularity=hour" \
-H "Authorization: Bearer $JWT_TOKEN"{
"granularity": "hour",
"period": "7d",
"series": {
"queryCount": [
{"timestamp": "2026-02-05T00:00:00Z", "value": 120},
{"timestamp": "2026-02-05T01:00:00Z", "value": 45}
],
"avgLatencyMs": [
{"timestamp": "2026-02-05T00:00:00Z", "value": 2100},
{"timestamp": "2026-02-05T01:00:00Z", "value": 1800}
],
"successRate": [
{"timestamp": "2026-02-05T00:00:00Z", "value": 0.97},
{"timestamp": "2026-02-05T01:00:00Z", "value": 0.98}
],
"cacheHitRate": [
{"timestamp": "2026-02-05T00:00:00Z", "value": 0.42},
{"timestamp": "2026-02-05T01:00:00Z", "value": 0.38}
],
"bytesScanned": [
{"timestamp": "2026-02-05T00:00:00Z", "value": 1073741824},
{"timestamp": "2026-02-05T01:00:00Z", "value": 536870912}
]
}
}Implementation
@GetMapping("/time-series")
public ResponseEntity<QueryAnalytics.TimeSeriesData> getTimeSeries(
@RequestParam(defaultValue = "7") int days,
@RequestParam(defaultValue = "hour") String granularity) {
UUID tenantId = SecurityUtils.getCurrentTenantId();
QueryAnalytics analytics = analyticsService.getAnalytics(tenantId, days, granularity);
return ResponseEntity.ok(analytics.getTimeSeries());
}