diff --git a/frontend/src/components/usage/CallHistogram.vue b/frontend/src/components/usage/CallHistogram.vue index 8cb0de74c..f72efca59 100644 --- a/frontend/src/components/usage/CallHistogram.vue +++ b/frontend/src/components/usage/CallHistogram.vue @@ -2,14 +2,28 @@

Calls per tool

- {{ tools.length }} tool{{ tools.length === 1 ? '' : 's' }} + {{ charted.length }} tool{{ charted.length === 1 ? '' : 's' }}
-
- No tool calls in this window. +
+ No completed tool calls in this window.
+ +

+ {{ unresolved.length }} name{{ unresolved.length === 1 ? '' : 's' }} never completed a call + and {{ unresolved.length === 1 ? 'is' : 'are' }} excluded here — see “Errors & latency”. +

@@ -26,22 +40,33 @@ import { } from 'chart.js' import type { ChartOptions } from 'chart.js' import type { UsageToolStat } from '@/types' -import { formatNumber, toolLabel, paletteColor } from '@/utils/usageFormat' +import { formatNumber, partitionUsageTools, toolLabel, paletteColor } from '@/utils/usageFormat' ChartJS.register(BarElement, CategoryScale, LinearScale, Tooltip, Legend) const props = defineProps<{ tools: UsageToolStat[] }>() +// This chart answers "what do my agents use". A name that has never once +// completed a call answers nothing about use — it is a typo the agent made or a +// server that was never reachable, and charting it invents a tool catalog out +// of failures (audit finding F22, #1046). +const split = computed(() => partitionUsageTools(props.tools)) +const charted = computed(() => split.value.completed) +const unresolved = computed(() => split.value.unresolved) +const unresolvedLabels = computed(() => + unresolved.value.map(t => toolLabel(t.server, t.tool)).join(', ') +) + // Horizontal bars so long server:tool labels stay readable on high cardinality. -const chartHeight = computed(() => `${Math.max(160, props.tools.length * 28 + 40)}px`) +const chartHeight = computed(() => `${Math.max(160, charted.value.length * 28 + 40)}px`) const chartData = computed(() => ({ - labels: props.tools.map(t => toolLabel(t.server, t.tool)), + labels: charted.value.map(t => toolLabel(t.server, t.tool)), datasets: [ { label: 'Calls', - data: props.tools.map(t => t.calls), - backgroundColor: props.tools.map((_, i) => paletteColor(i)), + data: charted.value.map(t => t.calls), + backgroundColor: charted.value.map((_, i) => paletteColor(i)), borderWidth: 0, borderRadius: 3, }, @@ -57,7 +82,7 @@ const chartOptions = computed>(() => ({ tooltip: { callbacks: { label: (ctx) => { - const t = props.tools[ctx.dataIndex] + const t = charted.value[ctx.dataIndex] if (!t) return '' const errPart = t.errors > 0 ? ` · ${formatNumber(t.errors)} errors` : '' return `${formatNumber(t.calls)} calls${errPart}` @@ -66,7 +91,12 @@ const chartOptions = computed>(() => ({ }, }, scales: { - x: { beginAtZero: true, ticks: { callback: (v) => formatNumber(Number(v)) } }, + // Say what the bars measure. An unlabelled axis is guesswork (F22, #1046). + x: { + beginAtZero: true, + title: { display: true, text: 'Calls (cumulative)' }, + ticks: { callback: (v) => formatNumber(Number(v)) }, + }, y: { ticks: { autoSkip: false, font: { size: 11 } } }, }, })) diff --git a/frontend/src/components/usage/ErrorRateChart.vue b/frontend/src/components/usage/ErrorRateChart.vue index 0637fa0ad..b8052547f 100644 --- a/frontend/src/components/usage/ErrorRateChart.vue +++ b/frontend/src/components/usage/ErrorRateChart.vue @@ -5,26 +5,44 @@ No tool calls in this window.