Skip to content

Commit 40346ca

Browse files
authored
[Uptime] Improve query performance with Heartbeat 7.6+ data. (#52433) (#54352)
This PR optimizes both the snapshot component and the monitor list on the overview page by using the new monitor.timespan field from elastic/beats#14778. Note that the functionality here will work with heartbeats lacking that patch, but the performance improvements will be absent. This PR adapts the snapshot tests to use synthetically generated data which should be easier to maintain. As a result some of that code is refactored as well. See #52433 parent issue as well.
1 parent ace1893 commit 40346ca

File tree

47 files changed

+493
-343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+493
-343
lines changed

x-pack/legacy/plugins/uptime/common/graphql/introspection.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2173,18 +2173,6 @@
21732173
"isDeprecated": false,
21742174
"deprecationReason": null
21752175
},
2176-
{
2177-
"name": "mixed",
2178-
"description": "",
2179-
"args": [],
2180-
"type": {
2181-
"kind": "NON_NULL",
2182-
"name": null,
2183-
"ofType": { "kind": "SCALAR", "name": "Int", "ofType": null }
2184-
},
2185-
"isDeprecated": false,
2186-
"deprecationReason": null
2187-
},
21882176
{
21892177
"name": "total",
21902178
"description": "",

x-pack/legacy/plugins/uptime/common/graphql/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,6 @@ export interface SnapshotCount {
419419

420420
down: number;
421421

422-
mixed: number;
423-
424422
total: number;
425423
}
426424

x-pack/legacy/plugins/uptime/common/runtime_types/snapshot/snapshot_count.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import * as t from 'io-ts';
88

99
export const SnapshotType = t.type({
1010
down: t.number,
11-
mixed: t.number,
1211
total: t.number,
1312
up: t.number,
1413
});

x-pack/legacy/plugins/uptime/public/components/functional/__tests__/snapshot.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ describe('Snapshot component', () => {
1313
const snapshot: Snapshot = {
1414
up: 8,
1515
down: 2,
16-
mixed: 0,
1716
total: 10,
1817
};
1918

x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/donut_chart.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/donut_chart_legend.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/__snapshots__/donut_chart_legend_row.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/donut_chart_legend_row.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import React from 'react';
1111
describe('DonutChartLegendRow', () => {
1212
it('passes appropriate props', () => {
1313
const wrapper = shallowWithIntl(
14-
<DonutChartLegendRow color="green" message="Foo" content={23} />
14+
<DonutChartLegendRow color="green" message="Foo" content={23} data-test-subj="foo" />
1515
);
1616
expect(wrapper).toMatchSnapshot();
1717
});

x-pack/legacy/plugins/uptime/public/components/functional/charts/donut_chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const DonutChart = ({ height, down, up, width }: DonutChartProps) => {
7373
<EuiFlexGroup alignItems="center" responsive={false}>
7474
<EuiFlexItem grow={false}>
7575
<svg
76-
aria-label={i18n.translate('xpack.uptime.donutChart.ariaLabel', {
76+
aria-label={i18n.translate('xpack.uptime.snapshot.donutChart.ariaLabel', {
7777
defaultMessage:
7878
'Pie chart showing the current status. {down} of {total} monitors are down.',
7979
values: { down, total: up + down },

x-pack/legacy/plugins/uptime/public/components/functional/charts/donut_chart_legend.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,19 @@ export const DonutChartLegend = ({ down, up }: Props) => {
3434
<DonutChartLegendRow
3535
color={danger}
3636
content={down}
37-
message={i18n.translate('xpack.uptime.donutChart.legend.downRowLabel', {
37+
message={i18n.translate('xpack.uptime.snapshot.donutChart.legend.downRowLabel', {
3838
defaultMessage: 'Down',
3939
})}
40+
data-test-subj={'xpack.uptime.snapshot.donutChart.down'}
4041
/>
4142
<EuiSpacer size="m" />
4243
<DonutChartLegendRow
4344
color={gray}
4445
content={up}
45-
message={i18n.translate('xpack.uptime.donutChart.legend.upRowLabel', {
46+
message={i18n.translate('xpack.uptime.snapshot.donutChart.legend.upRowLabel', {
4647
defaultMessage: 'Up',
4748
})}
49+
data-test-subj={'xpack.uptime.snapshot.donutChart.up'}
4850
/>
4951
</LegendContainer>
5052
);

0 commit comments

Comments
 (0)