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

@@ -3,7 +3,7 @@ package com.cameleer3.server.core.search;
/**
* Aggregate execution statistics.
*
* @param p99LatencyMs 99th percentile duration in milliseconds (last hour)
* @param p99LatencyMs 99th percentile duration in milliseconds within the requested time window
* @param activeCount number of currently running executions
*/
public record ExecutionStats(long p99LatencyMs, long activeCount) {}

View File

@@ -28,9 +28,11 @@ public interface SearchEngine {
/**
* Compute aggregate stats: P99 latency and count of currently running executions.
*
* @param from start of the time window
* @param to end of the time window
* @return execution stats
*/
ExecutionStats stats();
ExecutionStats stats(java.time.Instant from, java.time.Instant to);
/**
* Compute bucketed time-series stats over a time window.

View File

@@ -32,8 +32,8 @@ public class SearchService {
/**
* Compute aggregate execution stats (P99 latency, active count).
*/
public ExecutionStats stats() {
return engine.stats();
public ExecutionStats stats(java.time.Instant from, java.time.Instant to) {
return engine.stats(from, to);
}
/**