Skip to content
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 @@ -48,7 +48,18 @@ describe('padOrTruncateDurations', () => {
});

it('pads execution duration values when there are fewer than display desires', () => {
expect(padOrTruncateDurations([1, 2, 3], 10)).toEqual([1, 2, 3, 0, 0, 0, 0, 0, 0, 0]);
expect(padOrTruncateDurations([1, 2, 3], 10)).toEqual([
1,
2,
3,
null,
null,
null,
null,
null,
null,
null,
]);
});

it('truncates execution duration values when there are more than display desires', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,35 @@ export const ExecutionDurationChart: React.FunctionComponent<ComponentOpts> = ({
/>
<BarSeries
id="executionDuration"
name={i18n.translate(
'xpack.triggersActionsUI.sections.executionDurationChart.durationLabel',
{
defaultMessage: `Duration`,
}
)}
xScaleType="linear"
yScaleType="linear"
xAccessor={0}
yAccessors={[1]}
data={paddedExecutionDurations.map((val, ndx) => [ndx, val])}
minBarHeight={2}
/>
<LineSeries
id="rule_duration_avg"
name={i18n.translate(
'xpack.triggersActionsUI.sections.executionDurationChart.avgDurationLabel',
{
defaultMessage: `Avg Duration`,
}
)}
xScaleType="linear"
yScaleType="linear"
xAccessor={0}
yAccessors={[1]}
data={paddedExecutionDurations.map((val, ndx) => [ndx, executionDuration.average])}
data={paddedExecutionDurations.map((val, ndx) => [
ndx,
val ? executionDuration.average : null,
])}
curve={CurveType.CURVE_NATURAL}
/>
<Axis id="left-axis" position="left" tickFormat={(d) => formatMillisForDisplay(d)} />
Expand Down Expand Up @@ -125,7 +141,7 @@ export function padOrTruncateDurations(values: number[], desiredSize: number) {
if (values.length === desiredSize) {
return values;
} else if (values.length < desiredSize) {
return assign(fill(new Array(desiredSize), 0), values);
return assign(fill(new Array(desiredSize), null), values);
} else {
// oldest durations are at the start of the array, so take the last {desiredSize} values
return values.slice(-desiredSize);
Expand Down