Skip to content

Commit

Permalink
Merge pull request #139585 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-24.3-139342

release-24.3: ui: fix statement diag reports when min exec latency is null
  • Loading branch information
kyle-a-wong authored Jan 23, 2025
2 parents 5ac62b3 + bdc5736 commit fe7eb81
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/ui/workspaces/cluster-ui/src/api/statementDiagnosticsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import moment from "moment-timezone";

import { fetchData } from "src/api";

import { NumberToDuration } from "../util";
import { DurationToMomentDuration, NumberToDuration } from "../util";

const STATEMENT_DIAGNOSTICS_PATH = "_status/stmtdiagreports";
const CANCEL_STATEMENT_DIAGNOSTICS_PATH =
Expand All @@ -33,17 +33,17 @@ export async function getStatementDiagnosticsReports(): Promise<StatementDiagnos
STATEMENT_DIAGNOSTICS_PATH,
);
return response.reports.map(report => {
const minExecutionLatency = report.min_execution_latency
? DurationToMomentDuration(report.min_execution_latency)
: null;
return {
id: report.id.toString(),
statement_fingerprint: report.statement_fingerprint,
completed: report.completed,
statement_diagnostics_id: report.statement_diagnostics_id.toString(),
requested_at: moment.unix(report.requested_at.seconds.toNumber()),
min_execution_latency: moment.duration(
report.min_execution_latency.seconds.toNumber(),
"seconds",
),
expires_at: moment.unix(report.expires_at.seconds.toNumber()),
requested_at: moment.unix(report.requested_at?.seconds.toNumber()),
min_execution_latency: minExecutionLatency,
expires_at: moment.unix(report.expires_at?.seconds.toNumber()),
};
});
}
Expand Down

0 comments on commit fe7eb81

Please sign in to comment.