Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui/cluster-ui: add 'Interval Start Time' column to stmts/txns tables #70282

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ const statementStats: any = {
exec_stats: execStats,
};

const aggregatedTs = Date.parse("Sep 15 2021 01:00:00 GMT") * 1e-3;

export const getStatementDetailsPropsFixture = (): StatementDetailsProps => ({
history,
location: {
Expand Down Expand Up @@ -150,27 +152,31 @@ export const getStatementDetailsPropsFixture = (): StatementDetailsProps => ({
byNode: [
{
label: "4",
aggregatedTs,
implicitTxn: true,
database: "defaultdb",
fullScan: true,
stats: statementStats,
},
{
label: "3",
aggregatedTs,
implicitTxn: true,
database: "defaultdb",
fullScan: true,
stats: statementStats,
},
{
label: "2",
aggregatedTs,
implicitTxn: true,
database: "defaultdb",
fullScan: true,
stats: statementStats,
},
{
label: "1",
aggregatedTs,
implicitTxn: true,
database: "defaultdb",
fullScan: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ import {
databaseAttr,
StatementStatistics,
statementKey,
aggregatedTsAttr,
queryByName,
} from "../util";
import { AggregateStatistics } from "../statementsTable";
import { Fraction } from "./statementDetails";

interface StatementDetailsData {
nodeId: number;
aggregatedTs: number;
implicitTxn: boolean;
fullScan: boolean;
database: string;
Expand All @@ -48,6 +50,7 @@ function coalesceNodeStats(
if (!(key in statsKey)) {
statsKey[key] = {
nodeId: stmt.node_id,
aggregatedTs: stmt.aggregated_ts,
implicitTxn: stmt.implicit_txn,
fullScan: stmt.full_scan,
database: stmt.database,
Expand All @@ -61,6 +64,7 @@ function coalesceNodeStats(
const stmt = statsKey[key];
return {
label: stmt.nodeId.toString(),
aggregatedTs: stmt.aggregatedTs,
implicitTxn: stmt.implicitTxn,
fullScan: stmt.fullScan,
database: stmt.database,
Expand Down Expand Up @@ -96,9 +100,13 @@ function filterByRouterParamsPredicate(
const implicitTxn = getMatchParamByName(match, implicitTxnAttr) === "true";
const database = queryByName(location, databaseAttr);
let app = queryByName(location, appAttr);
// If the aggregatedTs is unset, we will aggregate across the current date range.
const aggregatedTs = queryByName(location, aggregatedTsAttr);

const filterByKeys = (stmt: ExecutionStatistics) =>
stmt.statement === statement &&
aggregatedTs == null &&
(aggregatedTs == null || stmt.aggregated_ts.toString() === aggregatedTs) &&
stmt.implicit_txn === implicitTxn &&
(stmt.database === database || database === null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
unique,
summarize,
queryByName,
aggregatedTsAttr,
} from "src/util";
import { Loading } from "src/loading";
import { Button } from "src/button";
Expand Down Expand Up @@ -520,6 +521,12 @@ export class StatementDetails extends React.Component<
const showRowsWritten =
stats.sql_type === "TypeDML" && summary.statement !== "select";

// If the aggregatedTs is unset, we are aggregating over the whole date range.
const aggregatedTs = queryByName(this.props.location, aggregatedTsAttr);
const intervalStartTime = aggregatedTs
? moment.unix(parseInt(aggregatedTs)).utc()
: this.props.dateRange[0];

return (
<Tabs
defaultActiveKey="1"
Expand Down Expand Up @@ -644,6 +651,11 @@ export class StatementDetails extends React.Component<
<Col className="gutter-row" span={8}>
<SummaryCard className={cx("summary-card")}>
<Heading type="h5">Statement details</Heading>
<div className={summaryCardStylesCx("summary--card__item")}>
<Text>Interval start time</Text>
<Text>{intervalStartTime.format("MMM D, h:mm A (UTC)")}</Text>
</div>

{!isTenant && (
<div>
<div className={summaryCardStylesCx("summary--card__item")}>
Expand Down
Loading