diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx index 06a2cd0665..175088ca0b 100644 --- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx @@ -23,7 +23,7 @@ const createLogEntry = (overrides: Partial = {}): LogEntry => startTime: "2025-11-14T00:00:00Z", endTime: "2025-11-14T00:00:01Z", cache_hit: "miss", - duration: 1, + request_duration_ms: 1000, messages: [{ role: "user", content: "hello" }], response: { choices: [{ message: { content: "hi" } }] }, metadata: { status: "success" }, diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx index f8c588e77a..533e51d31b 100644 --- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx @@ -283,7 +283,7 @@ function MetricsSection({ logEntry, metadata }: { logEntry: LogEntry; metadata: /> ${formatNumberWithCommas(logEntry.spend || 0, 8)} - {logEntry.duration?.toFixed(3)} s + {logEntry.request_duration_ms != null ? (logEntry.request_duration_ms / 1000).toFixed(3) : "-"} s {hasCacheActivity && ( <> diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx index 6f85c81ce1..b1012642c3 100644 --- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx @@ -47,8 +47,8 @@ interface TraceEventRowProps { function TraceEventRow({ row, isSelected, onClick }: TraceEventRowProps) { const isMcp = MCP_CALL_TYPES.includes(row.call_type); const durationValue = - row.duration != null - ? row.duration.toFixed(3) + row.request_duration_ms != null + ? (row.request_duration_ms / 1000).toFixed(3) : row.startTime && row.endTime ? ((Date.parse(row.endTime) - Date.parse(row.startTime)) / 1000).toFixed(3) : "-"; @@ -125,7 +125,7 @@ export function LogDetailsDrawer({ return allSessionLogs .map((row) => ({ ...row, - duration: (Date.parse(row.endTime) - Date.parse(row.startTime)) / 1000, + request_duration_ms: row.request_duration_ms ?? (Date.parse(row.endTime) - Date.parse(row.startTime)), })) .sort((a, b) => { const aIsMcp = MCP_CALL_TYPES.includes(a.call_type) ? 1 : 0; diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.test.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.test.tsx index b7c0318d9f..47beea1bb8 100644 --- a/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.test.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.test.tsx @@ -21,7 +21,7 @@ const baseLogEntry: LogEntry = { startTime: "2025-11-14T00:00:00Z", endTime: "2025-11-14T00:00:00Z", cache_hit: "miss", - duration: 1, + request_duration_ms: 1000, messages: [{ role: "user", content: "hello" }], response: { status: "ok" }, metadata: { diff --git a/ui/litellm-dashboard/src/components/view_logs/columns.tsx b/ui/litellm-dashboard/src/components/view_logs/columns.tsx index 526a111e06..7cea1a3638 100644 --- a/ui/litellm-dashboard/src/components/view_logs/columns.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/columns.tsx @@ -14,6 +14,7 @@ export const LOGS_SORT_FIELD_MAP = { startTime: "startTime", spend: "spend", total_tokens: "total_tokens", + request_duration_ms: "request_duration_ms", } as const; export type LogsSortField = keyof typeof LOGS_SORT_FIELD_MAP; @@ -61,7 +62,7 @@ export type LogEntry = { proxy_server_request?: string | any[] | Record; session_id?: string; status?: string; - duration?: number; + request_duration_ms?: number; session_total_count?: number; session_total_spend?: number; mcp_tool_call_count?: number; @@ -231,13 +232,28 @@ export const createColumns = (sortProps?: LogsSortProps): ColumnDef[] }, }, { - header: "Duration (s)", - accessorKey: "duration", - cell: (info: any) => ( - - {String(info.getValue() || "-")} - - ), + header: sortProps + ? () => ( + + ) + : "Duration (s)", + accessorKey: "request_duration_ms", + cell: (info: any) => { + const ms = info.getValue(); + if (ms == null) return -; + const seconds = (ms / 1000).toFixed(2); + return ( + + {seconds} + + ); + }, }, { header: "Team Name", diff --git a/ui/litellm-dashboard/src/components/view_logs/index.test.tsx b/ui/litellm-dashboard/src/components/view_logs/index.test.tsx index 7d4fc98111..936c3b310b 100644 --- a/ui/litellm-dashboard/src/components/view_logs/index.test.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/index.test.tsx @@ -55,7 +55,7 @@ const baseLogEntry: LogEntry = { startTime: "2025-11-14T00:00:00Z", endTime: "2025-11-14T00:00:00Z", cache_hit: "miss", - duration: 1, + request_duration_ms: 1000, messages: [{ role: "user", content: "hello" }], response: { status: "ok" }, metadata: { diff --git a/ui/litellm-dashboard/src/components/view_logs/index.tsx b/ui/litellm-dashboard/src/components/view_logs/index.tsx index eb6550d782..d76d3e93aa 100644 --- a/ui/litellm-dashboard/src/components/view_logs/index.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/index.tsx @@ -341,7 +341,7 @@ export default function SpendLogsTable({ const sessionComposition = log.session_id ? sessionCompositionById[log.session_id] : undefined; return { ...log, - duration: (Date.parse(log.endTime) - Date.parse(log.startTime)) / 1000, + request_duration_ms: log.request_duration_ms, session_llm_count: sessionComposition?.llm ?? undefined, session_mcp_count: sessionComposition?.mcp ?? undefined, onKeyHashClick: (keyHash: string) => setSelectedKeyIdInfoView(keyHash), @@ -943,7 +943,7 @@ export function RequestViewer({ row, onOpenSettings }: { row: Row; onO
Duration: - {row.original.duration} s. + {row.original.request_duration_ms != null ? (row.original.request_duration_ms / 1000).toFixed(3) : "-"} s.
{row.original.metadata?.litellm_overhead_time_ms !== undefined && (