Make stats endpoint respect selected time window instead of hardcoded last hour
All checks were successful
CI / build (push) Successful in 1m10s
CI / docker (push) Successful in 48s
CI / deploy (push) Successful in 28s

P99 latency and active count now use the same from/to parameters as the
timeseries sparklines, so all stat cards are consistent with the user's
selected time range.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-03-13 22:19:59 +01:00
parent 6794e4c234
commit cdf4c93630
9 changed files with 57 additions and 18 deletions

View File

@@ -70,8 +70,11 @@ public class SearchController {
@GetMapping("/stats")
@Operation(summary = "Aggregate execution stats (P99 latency, active count)")
public ResponseEntity<ExecutionStats> stats() {
return ResponseEntity.ok(searchService.stats());
public ResponseEntity<ExecutionStats> stats(
@RequestParam Instant from,
@RequestParam(required = false) Instant to) {
Instant end = to != null ? to : Instant.now();
return ResponseEntity.ok(searchService.stats(from, end));
}
@GetMapping("/stats/timeseries")