Always use summary events for monitor info (#82376)

* Always use summary events for monitor info

Fixes https://github.com/elastic/kibana/issues/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
This commit is contained in:
Andrew Cholakian 2020-11-02 20:10:01 -06:00 committed by GitHub
parent 5b6e94bbad
commit e94db6329d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -17,6 +17,11 @@ describe('getLatestMonitor', () => {
query: {
bool: {
filter: [
{
exists: {
field: 'summary',
},
},
{
range: {
'@timestamp': {

View file

@ -18,8 +18,6 @@ export interface GetLatestMonitorParams {
monitorId?: string | null;
observerLocation?: string;
status?: string;
}
// Get The monitor latest state sorted by timestamp with date range
@ -30,7 +28,6 @@ export const getLatestMonitor: UMElasticsearchQueryFn<GetLatestMonitorParams, Pi
dateEnd,
monitorId,
observerLocation,
status,
}) => {
const params = {
index: dynamicSettings.heartbeatIndices,
@ -38,6 +35,7 @@ export const getLatestMonitor: UMElasticsearchQueryFn<GetLatestMonitorParams, Pi
query: {
bool: {
filter: [
{ exists: { field: 'summary' } },
{
range: {
'@timestamp': {
@ -46,7 +44,6 @@ export const getLatestMonitor: UMElasticsearchQueryFn<GetLatestMonitorParams, Pi
},
},
},
...(status ? [{ term: { 'monitor.status': status } }] : []),
...(monitorId ? [{ term: { 'monitor.id': monitorId } }] : []),
...(observerLocation ? [{ term: { 'observer.geo.name': observerLocation } }] : []),
],