Skip to content

Commit

Permalink
Always use summary events for monitor info (elastic#82376)
Browse files Browse the repository at this point in the history
* Always use summary events for monitor info

Fixes elastic#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
  • Loading branch information
andrewvc committed Nov 3, 2020
1 parent c9e57a6 commit 60ca60c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ describe('getLatestMonitor', () => {
query: {
bool: {
filter: [
{
exists: {
field: 'summary',
},
},
{
range: {
'@timestamp': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,14 +28,14 @@ export const getLatestMonitor: UMElasticsearchQueryFn<GetLatestMonitorParams, Pi
dateEnd,
monitorId,
observerLocation,
status,
}) => {
const params = {
index: dynamicSettings.heartbeatIndices,
body: {
query: {
bool: {
filter: [
{ exists: { field: 'summary' } },
{
range: {
'@timestamp': {
Expand All @@ -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 } }] : []),
],
Expand Down

0 comments on commit 60ca60c

Please sign in to comment.