Skip to content

Commit 6d9e386

Browse files
committed
just treat duration as nanoseconds, don't worry about the postgresql store as its deprecated
1 parent 9a5e7c0 commit 6d9e386

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

apps/webapp/app/routes/api.v1.runs.$runId.spans.$spanId.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@ export const loader = createLoaderApiRoute(
5454
return json({ error: "Span not found" }, { status: 404 });
5555
}
5656

57-
// Postgres eventRepository returns duration in ms, ClickHouse returns nanoseconds
58-
const isClickhouse =
59-
run.taskEventStore === "clickhouse" || run.taskEventStore === "clickhouse_v2";
60-
const durationMs = isClickhouse ? span.duration / 1_000_000 : span.duration;
57+
// Duration is nanoseconds from ClickHouse (Postgres store is deprecated)
58+
const durationMs = span.duration / 1_000_000;
6159

6260
const aiData =
6361
span.properties && typeof span.properties === "object"

packages/cli-v3/src/mcp/formatters.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,8 @@ function formatSpan(
236236

237237
// Format span header
238238
const statusIndicator = getStatusIndicator(span.data);
239-
// Trace durations from ClickHouse are nanoseconds, from Postgres are milliseconds.
240-
// Normalize: values over 1e6 are nanoseconds (1e6 ns = 1ms; 1e6 ms = 16min).
241-
const durationMs =
242-
span.data.duration > 1_000_000 ? span.data.duration / 1_000_000 : span.data.duration;
243-
const duration = formatDuration(durationMs);
239+
// Trace durations are nanoseconds from ClickHouse
240+
const duration = formatDuration(span.data.duration / 1_000_000);
244241
const startTime = formatDateTime(span.data.startTime);
245242

246243
lines.push(`${indent}${prefix} [${span.id}] ${span.data.message} ${statusIndicator}`);

0 commit comments

Comments
 (0)