Skip to content

Commit

Permalink
increase uptime/synthetics timespan filter from -5m to -20m
Browse files Browse the repository at this point in the history
  • Loading branch information
dominiqueclarke committed Nov 8, 2022
1 parent 096f465 commit e538ac4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const getTimeSpanFilter = () => ({
range: {
'monitor.timespan': {
lte: moment().toISOString(),
gte: moment().subtract(5, 'minutes').toISOString(),
gte: moment().subtract(20, 'minutes').toISOString(),
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum SortFields {
export const DEFAULT_SORT = 'not_after';
export const DEFAULT_DIRECTION = 'asc';
export const DEFAULT_SIZE = 20;
export const DEFAULT_FROM = 'now-5m';
export const DEFAULT_FROM = 'now-20m';
export const DEFAULT_TO = 'now';

export const getCertsRequestBody = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
*/

import { useSelector } from 'react-redux';
import moment from 'moment';
import { useMemo } from 'react';
import { useEsSearch } from '@kbn/observability-plugin/public';
import { selectEncryptedSyntheticsSavedMonitors } from '../../../state';
import { Ping } from '../../../../../../common/runtime_types';
import { EXCLUDE_RUN_ONCE_FILTER } from '../../../../../../common/constants/client_defaults';
import {
EXCLUDE_RUN_ONCE_FILTER,
getTimeSpanFilter,
} from '../../../../../../common/constants/client_defaults';
import { useSyntheticsRefreshContext } from '../../../contexts/synthetics_refresh_context';
import { useInlineErrorsCount } from './use_inline_errors_count';
import { SYNTHETICS_INDEX_PATTERN } from '../../../../../../common/constants';
Expand Down Expand Up @@ -53,10 +55,7 @@ export const getInlineErrorFilters = () => [
},
{
range: {
'monitor.timespan': {
lte: moment().toISOString(),
gte: moment().subtract(5, 'minutes').toISOString(),
},
'monitor.timespan': getTimeSpanFilter(),
},
},
EXCLUDE_RUN_ONCE_FILTER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
*/

import { useSelector } from 'react-redux';
import moment from 'moment';
import { useMemo } from 'react';
import { useEsSearch } from '@kbn/observability-plugin/public';
import { monitorManagementListSelector } from '../../../state/selectors';
import { Ping } from '../../../../../common/runtime_types';
import { EXCLUDE_RUN_ONCE_FILTER } from '../../../../../common/constants/client_defaults';
import {
EXCLUDE_RUN_ONCE_FILTER,
getTimeSpanFilter,
} from '../../../../../common/constants/client_defaults';
import { useUptimeRefreshContext } from '../../../contexts/uptime_refresh_context';
import { useInlineErrorsCount } from './use_inline_errors_count';
import { SYNTHETICS_INDEX_PATTERN } from '../../../../../common/constants';
Expand Down Expand Up @@ -53,10 +55,7 @@ export const getInlineErrorFilters = () => [
},
{
range: {
'monitor.timespan': {
lte: moment().toISOString(),
gte: moment().subtract(5, 'minutes').toISOString(),
},
'monitor.timespan': getTimeSpanFilter(),
},
},
EXCLUDE_RUN_ONCE_FILTER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ describe(QueryContext, () => {
});

describe('timespanClause()', () => {
it('should always cover the last 5m', () => {
it('should always cover the last 20m', () => {
// 5m expected range between GTE and LTE in the response
// since timespan is hardcoded to 5m
expect(qc.timespanClause()).toEqual({
range: {
'monitor.timespan': {
// end date minus 5m
gte: new Date(Date.parse(rangeEnd) - 5 * 60 * 1000).toISOString(),
gte: new Date(Date.parse(rangeEnd) - 20 * 60 * 1000).toISOString(),
lte: rangeEnd,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class QueryContext {
// which is a bit dicey since we may have data that predates this field existing,
// or we may have data that has it, but a slow ingestion process.
timespanClause() {
// We subtract 5m from the start to account for data that shows up late,
// We subtract 20m from the start to account for data that shows up late,
// for instance, with a large value for the elasticsearch refresh interval
// setting it lower can work very well on someone's laptop, but with real world
// latencies and slowdowns that's dangerous. Making this value larger makes things
Expand All @@ -107,7 +107,7 @@ export class QueryContext {
return {
range: {
'monitor.timespan': {
gte: 'now-5m',
gte: 'now-20m',
lte: 'now',
},
},
Expand Down

0 comments on commit e538ac4

Please sign in to comment.