Skip to content

Commit f559e51

Browse files
authored
feat: add duration to the Request Logs details (#20756)
This pull-request simply implements a new field within our `Request Log`s details view where-in we describe back to the user how long their request took based on the `end_date - start_date` in a human-like way. Users can hover the value to see the `title=` for the true value. <img width="2358" height="936" alt="CleanShot 2025-11-13 at 11 51 56@2x" src="/api/flow.js?q=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fcommit%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/f69c87cd-2735-4e03-9fc8-ae0f4d94b5d1">https://github.com/user-attachments/assets/f69c87cd-2735-4e03-9fc8-ae0f4d94b5d1" />
1 parent a8f2a8a commit f559e51

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
} from "lucide-react";
1616
import { type FC, Fragment, useState } from "react";
1717
import { cn } from "utils/cn";
18+
import { humanDuration } from "utils/time";
1819

1920
type RequestLogsRowProps = {
2021
interception: AIBridgeInterception;
@@ -34,6 +35,13 @@ export const RequestLogsRow: FC<RequestLogsRowProps> = ({ interception }) => {
3435
0,
3536
);
3637
const toolCalls = interception.tool_usages.length;
38+
const duration =
39+
interception.ended_at &&
40+
Math.max(
41+
0,
42+
new Date(interception.ended_at).getTime() -
43+
new Date(interception.started_at).getTime(),
44+
);
3745

3846
return (
3947
<>
@@ -123,6 +131,15 @@ export const RequestLogsRow: FC<RequestLogsRowProps> = ({ interception }) => {
123131
</>
124132
)}
125133

134+
{(duration || duration === 0) && (
135+
<>
136+
<dt>Duration:</dt>
137+
<dd title={duration.toString()} data-chromatic="ignore">
138+
{humanDuration(duration)}
139+
</dd>
140+
</>
141+
)}
142+
126143
<dt>Initiator:</dt>
127144
<dd data-chromatic="ignore">
128145
{interception.initiator.username}

0 commit comments

Comments
 (0)