feat(ui): add TTFT (s) column to request logs table

This commit is contained in:
Ishaan Jaffer 2026-03-04 15:09:53 -08:00
parent 4059b4f942
commit fbd8c445e6

View file

@ -62,6 +62,7 @@ export type LogEntry = {
proxy_server_request?: string | any[] | Record<string, any>;
session_id?: string;
status?: string;
completionStartTime?: string;
request_duration_ms?: number;
session_total_count?: number;
session_total_spend?: number;
@ -270,6 +271,25 @@ export const createColumns = (sortProps?: LogsSortProps): ColumnDef<LogEntry>[]
);
},
},
{
header: "TTFT (s)",
accessorKey: "completionStartTime",
cell: (info: any) => {
const row = info.row.original;
const completionStartTime = info.getValue();
if (!completionStartTime) return <span>-</span>;
// For non-streaming, completionStartTime == endTime so TTFT is not meaningful
if (completionStartTime === row.endTime) return <span>-</span>;
const ttftMs = new Date(completionStartTime).getTime() - new Date(row.startTime).getTime();
if (ttftMs <= 0) return <span>-</span>;
const ttftSeconds = (ttftMs / 1000).toFixed(2);
return (
<Tooltip title={`${ttftMs}ms`}>
<span className="max-w-[15ch] truncate block">{ttftSeconds}</span>
</Tooltip>
);
},
},
{
header: "Team Name",
accessorKey: "metadata.user_api_key_team_alias",