Time taken column logs (#11723)

* Time taken column logs

* Reanme and details

* Add detail row
This commit is contained in:
Gustavo Brian 2025-06-14 21:29:52 +02:00 • committed by GitHub
parent 16a5f36441
commit 22460a73f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View file

@ -46,6 +46,7 @@ export type LogEntry = {
proxy_server_request?: string | any[] | Record<string, any>;
session_id?: string;
status?: string;
duration?: number;
onKeyHashClick?: (keyHash: string) => void;
onSessionClick?: (sessionId: string) => void;
};
@ -160,6 +161,15 @@ export const columns: ColumnDef<LogEntry>[] = [
<span>${Number(info.getValue() || 0).toFixed(6)}</span>
),
},
{
header: "Duration",
accessorKey: "duration",
cell: (info: any) => (
<Tooltip title={String(info.getValue() || "-")}>
<span className="max-w-[15ch] truncate block">{String(info.getValue() || "-")}</span>
</Tooltip>
),
},
{
header: "Team Name",
accessorKey: "metadata.user_api_key_team_alias",

View file

@ -369,6 +369,7 @@ export default function SpendLogsTable({
}).map(log => ({
...log,
duration: (Date.parse(log.endTime) - Date.parse(log.startTime)) / 1000,
onKeyHashClick: (keyHash: string) => setSelectedKeyIdInfoView(keyHash),
onSessionClick: (sessionId: string) => {
if (sessionId) setSelectedSessionId(sessionId);
@ -931,6 +932,10 @@ export function RequestViewer({ row }: { row: Row<LogEntry> }) {
<span className="font-medium w-1/3">End Time:</span>
<span>{row.original.endTime}</span>
</div>
<div className="flex">
<span className="font-medium w-1/3">Duration:</span>
<span>{row.original.duration} s.</span>
</div>
</div>
</div>
</div>