Skip to content

Commit 9a5e7c0

Browse files
committed
fixed the duration formatter to work with nanoseconds
1 parent 922c34f commit 9a5e7c0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@ function formatSpan(
236236

237237
// Format span header
238238
const statusIndicator = getStatusIndicator(span.data);
239-
const duration = formatDuration(span.data.duration);
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);
240244
const startTime = formatDateTime(span.data.startTime);
241245

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

0 commit comments

Comments
 (0)