Skip to content

Commit 546ee08

Browse files
committed
Add Tool Calls column to Client Identities table
Added tracking and display of tool call counts per client in the Metrics page: - Added toolCallCount field to ClientMetrics interface - Updated MetricsCounter to track tool calls (methods starting with 'tools/call:') - Added Tool Calls column to the Client Identities table in StatelessTransportMetrics - Column displays the total number of tool calls made by each client
1 parent 401028e commit 546ee08

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

packages/app/src/shared/transport-metrics.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export interface ClientMetrics {
7575
isConnected: boolean;
7676
activeConnections: number;
7777
totalConnections: number;
78+
toolCallCount: number;
7879
}
7980

8081
/**
@@ -224,6 +225,7 @@ export interface TransportMetricsResponse {
224225
isConnected: boolean;
225226
activeConnections: number;
226227
totalConnections: number;
228+
toolCallCount: number;
227229
}>;
228230

229231
sessions: SessionData[];
@@ -525,6 +527,7 @@ export class MetricsCounter {
525527
isConnected: true,
526528
activeConnections: 1,
527529
totalConnections: 1,
530+
toolCallCount: 0,
528531
};
529532
this.metrics.clients.set(clientKey, clientMetrics);
530533
} else {
@@ -608,6 +611,15 @@ export class MetricsCounter {
608611
}
609612

610613
clientMethodMetrics.count++;
614+
615+
// If this is a tool call, increment the client's tool call count
616+
if (method.startsWith('tools/call:')) {
617+
const clientKey = getClientKey(clientInfo.name, clientInfo.version);
618+
const clientMetrics = this.metrics.clients.get(clientKey);
619+
if (clientMetrics) {
620+
clientMetrics.toolCallCount++;
621+
}
622+
}
611623
}
612624

613625
if (isError) {

packages/app/src/web/components/StatelessTransportMetrics.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type ClientData = {
1717
isConnected: boolean;
1818
lastSeen: string;
1919
firstSeen: string;
20+
toolCallCount: number;
2021
};
2122

2223
/**
@@ -102,6 +103,11 @@ export function StatelessTransportMetrics({ metrics }: StatelessTransportMetrics
102103
header: createSortableHeader('Initializations', 'right'),
103104
cell: ({ row }) => <div className="text-right font-mono text-sm">{row.getValue<number>('requestCount')}</div>,
104105
},
106+
{
107+
accessorKey: 'toolCallCount',
108+
header: createSortableHeader('Tool Calls', 'right'),
109+
cell: ({ row }) => <div className="text-right font-mono text-sm">{row.getValue<number>('toolCallCount')}</div>,
110+
},
105111
{
106112
accessorKey: 'isConnected',
107113
header: createSortableHeader('Status'),

0 commit comments

Comments
 (0)