Skip to content

Commit

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

release-24.3: ui: add Redact option to stmt diag activation modal
  • Loading branch information
dhartunian authored Nov 14, 2024
2 parents 13c52d5 + 258238e commit 6544f23
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export type InsertStmtDiagnosticRequest = {
minExecutionLatencySeconds?: number;
expiresAfterSeconds?: number;
planGist: string;
redacted: boolean;
};

export type InsertStmtDiagnosticResponse = {
Expand All @@ -73,6 +74,7 @@ export async function createStatementDiagnosticsReport(
min_execution_latency: NumberToDuration(req.minExecutionLatencySeconds),
expires_after: NumberToDuration(req.expiresAfterSeconds),
plan_gist: req.planGist,
redacted: req.redacted,
}),
).then(response => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const ActivateStatementDiagnosticsModal = React.forwardRef<
const [minExecLatencyUnit, setMinExecLatencyUnit] = useState("milliseconds");
const [expiresAfter, setExpiresAfter] = useState(15);
const [traceSampleRate, setTraceSampleRate] = useState(0.01);
const [redacted, setRedacted] = useState(false);

const handleSelectChange = (value: string) => {
setMinExecLatencyUnit(value);
Expand Down Expand Up @@ -95,6 +96,7 @@ export const ActivateStatementDiagnosticsModal = React.forwardRef<
),
expiresAfterSeconds: getExpiresAfter(expires, expiresAfter),
samplingProbability: getTraceSampleRate(conditional, traceSampleRate),
redacted: redacted,
});
setVisible(false);
}, [
Expand All @@ -108,6 +110,7 @@ export const ActivateStatementDiagnosticsModal = React.forwardRef<
traceSampleRate,
filterPerPlanGist,
selectedPlanGist,
redacted,
]);

const onCancelHandler = useCallback(() => setVisible(false), []);
Expand Down Expand Up @@ -313,6 +316,10 @@ export const ActivateStatementDiagnosticsModal = React.forwardRef<
/>
</div>
)}
<Divider type="horizontal" />
<Checkbox checked={redacted} onChange={() => setRedacted(!redacted)}>
<Text>Redact</Text>
</Checkbox>
</Space>
</ConfigProvider>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe("statementsDiagnostics sagas", () => {
minExecutionLatencySeconds: minExecLatency,
expiresAfterSeconds: expiresAfter,
planGist: planGist,
redacted: false,
};

const insertResponse: InsertStmtDiagnosticResponse = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe("statementsSagas", () => {
minExecutionLatencySeconds: minExecLatency,
expiresAfterSeconds: expiresAfter,
planGist: planGist,
redacted: false,
};
const action = createStatementDiagnosticsReportAction(
insertStmtDiagnosticsRequest,
Expand Down Expand Up @@ -72,6 +73,7 @@ describe("statementsSagas", () => {
minExecutionLatencySeconds: minExecLatency,
expiresAfterSeconds: expiresAfter,
planGist: planGist,
redacted: false,
};
const action = createStatementDiagnosticsReportAction(
insertStmtDiagnosticsRequest,
Expand Down

0 comments on commit 6544f23

Please sign in to comment.