feat: add delta mode for counter metrics using ClickHouse lag()
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m17s
CI / docker (push) Successful in 1m12s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 42s

Counter metrics like chunks.exported.count are monotonically increasing.
Add mode=delta query parameter to the agent metrics API that computes
per-bucket deltas server-side using ClickHouse lag() window function:
max(value) per bucket, then greatest(0, current - previous) to get the
increase per period with counter-reset handling.

The chunks exported/dropped charts now show throughput per bucket
instead of the ever-increasing cumulative total.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-13 10:56:06 +02:00
parent ae908fb382
commit e57343e3df
5 changed files with 69 additions and 5 deletions

View File

@@ -75,7 +75,7 @@ export default function AgentInstance() {
const { data: agentMetrics } = useAgentMetrics(
agent?.instanceId || null,
['cameleer.chunks.exported.count', 'cameleer.chunks.dropped.count'],
60, timeFrom, timeTo,
60, timeFrom, timeTo, 'delta',
);
const feedEvents = useMemo<FeedEvent[]>(() => {