Skip to content

Commit e94db63

Browse files
authored
Always use summary events for monitor info (#82376)
* Always use summary events for monitor info Fixes #81942 With synthetics we no longer are guaranteed to have the URL or other monitor info fields in every single event. This PR patches the monitor status API to only query summary fields for this info. As an added benefit, this is a bit more consistent as well because we tend to only show data from completed, not partial checks, in most places. This also removes the status check parameter from this API, which otherwise would need to be refactored. Checking the codebase it appears unused. * Remove unneeded params
1 parent 5b6e94b commit e94db63

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ describe('getLatestMonitor', () => {
1717
query: {
1818
bool: {
1919
filter: [
20+
{
21+
exists: {
22+
field: 'summary',
23+
},
24+
},
2025
{
2126
range: {
2227
'@timestamp': {

x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ export interface GetLatestMonitorParams {
1818
monitorId?: string | null;
1919

2020
observerLocation?: string;
21-
22-
status?: string;
2321
}
2422

2523
// Get The monitor latest state sorted by timestamp with date range
@@ -30,14 +28,14 @@ export const getLatestMonitor: UMElasticsearchQueryFn<GetLatestMonitorParams, Pi
3028
dateEnd,
3129
monitorId,
3230
observerLocation,
33-
status,
3431
}) => {
3532
const params = {
3633
index: dynamicSettings.heartbeatIndices,
3734
body: {
3835
query: {
3936
bool: {
4037
filter: [
38+
{ exists: { field: 'summary' } },
4139
{
4240
range: {
4341
'@timestamp': {
@@ -46,7 +44,6 @@ export const getLatestMonitor: UMElasticsearchQueryFn<GetLatestMonitorParams, Pi
4644
},
4745
},
4846
},
49-
...(status ? [{ term: { 'monitor.status': status } }] : []),
5047
...(monitorId ? [{ term: { 'monitor.id': monitorId } }] : []),
5148
...(observerLocation ? [{ term: { 'observer.geo.name': observerLocation } }] : []),
5249
],

0 commit comments

Comments
 (0)