Skip to content

Commit

Permalink
Bug 1838024 - Limit the length of the replicates tooltip to 250 chars. (
Browse files Browse the repository at this point in the history
  • Loading branch information
gmierz committed Jun 21, 2023
1 parent ab32993 commit c457ccc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
36 changes: 32 additions & 4 deletions ui/perfherder/compare/TableAverage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,46 @@ import PropTypes from 'prop-types';
import { Badge } from 'reactstrap';

import SimpleTooltip from '../../shared/SimpleTooltip';
import { replicatesMaxLength } from '../perf-helpers/constants';
import { displayNumber, formatNumber } from '../perf-helpers/helpers';

import TooltipGraph from './TooltipGraph';

const TableAverage = ({ value, stddev, stddevpct, replicates, app }) => {
let tooltipText;
if (replicates.length > 1) {
tooltipText = `Runs: < ${replicates
const replicatesStr = replicates
.map((value) => formatNumber(value))
.join(' ')} > ${formatNumber(displayNumber(stddev))} = ${formatNumber(
displayNumber(stddevpct),
)}% standard deviation)`;
.join(' ');

if (replicatesStr.length > replicatesMaxLength) {
tooltipText = (
<>
{`Runs: < ${replicatesStr.slice(
0,
Math.floor(replicatesMaxLength / 2),
)}`}
...
{`${replicatesStr.slice(
replicatesStr.length - Math.floor(replicatesMaxLength / 2),
)} > `}
{`${formatNumber(displayNumber(stddev))} = ${formatNumber(
displayNumber(stddevpct),
)}% `}
standard deviation
<br />
(use JSON download button to see more)
</>
);
} else {
tooltipText = (
<>
{`Runs: < ${replicatesStr} > ${formatNumber(
displayNumber(stddev),
)} = ${formatNumber(displayNumber(stddevpct))}% standard deviation`}
</>
);
}
} else if (replicates.length === 1) {
tooltipText = 'Only one run (consider more for greater confidence)';
}
Expand Down
2 changes: 2 additions & 0 deletions ui/perfherder/perf-helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,5 @@ export const noiseProfiles = {
};

export const timeToTriage = 3;

export const replicatesMaxLength = 250;

0 comments on commit c457ccc

Please sign in to comment.