mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
feat(ui): add TTFT (s) column to request logs table
This commit is contained in:
parent
4059b4f942
commit
fbd8c445e6
1 changed files with 20 additions and 0 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue