[8.6] increase uptime/synthetics timespan filter from -5m to -20m (#144769) (#145762)

# Backport

This will backport the following commits from `main` to `8.6`:
- [increase uptime/synthetics timespan filter from -5m to -20m
(#144769)](https://github.com/elastic/kibana/pull/144769)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Dominique
Clarke","email":"dominique.clarke@elastic.co"},"sourceCommit":{"committedDate":"2022-11-18T17:00:33Z","message":"increase
uptime/synthetics timespan filter from -5m to -20m
(#144769)\n\nCo-authored-by: shahzad31
<shahzad.muhammad@elastic.co>\r\nResolves
https://github.com/elastic/kibana/issues/144097","sha":"9b87a14599416566953f9135b58f760f0bf0ba93","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:uptime","release_note:skip","v8.6.0","v8.7.0"],"number":144769,"url":"https://github.com/elastic/kibana/pull/144769","mergeCommit":{"message":"increase
uptime/synthetics timespan filter from -5m to -20m
(#144769)\n\nCo-authored-by: shahzad31
<shahzad.muhammad@elastic.co>\r\nResolves
https://github.com/elastic/kibana/issues/144097","sha":"9b87a14599416566953f9135b58f760f0bf0ba93"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/144769","number":144769,"mergeCommit":{"message":"increase
uptime/synthetics timespan filter from -5m to -20m
(#144769)\n\nCo-authored-by: shahzad31
<shahzad.muhammad@elastic.co>\r\nResolves
https://github.com/elastic/kibana/issues/144097","sha":"9b87a14599416566953f9135b58f760f0bf0ba93"}}]}]
BACKPORT-->

Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
This commit is contained in:
Kibana Machine 2022-11-18 13:08:46 -05:00 committed by GitHub
parent 8f1802dd32
commit 4ed7e7048f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 31 deletions

View file

@ -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(),
},
},
});

View file

@ -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 = ({

View file

@ -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';
@ -51,14 +53,7 @@ export const getInlineErrorFilters = () => [
],
},
},
{
range: {
'monitor.timespan': {
lte: moment().toISOString(),
gte: moment().subtract(5, 'minutes').toISOString(),
},
},
},
getTimeSpanFilter(),
EXCLUDE_RUN_ONCE_FILTER,
];

View file

@ -51,7 +51,7 @@ describe('useInlineErrors', function () {
{
range: {
'monitor.timespan': {
gte: '2022-01-01T23:55:00.000Z',
gte: '2022-01-01T23:40:00.000Z',
lte: '2022-01-02T00:00:00.000Z',
},
},

View file

@ -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';
@ -51,14 +53,7 @@ export const getInlineErrorFilters = () => [
],
},
},
{
range: {
'monitor.timespan': {
lte: moment().toISOString(),
gte: moment().subtract(5, 'minutes').toISOString(),
},
},
},
getTimeSpanFilter(),
EXCLUDE_RUN_ONCE_FILTER,
];

View file

@ -51,7 +51,7 @@ describe('useInlineErrorsCount', function () {
{
range: {
'monitor.timespan': {
gte: '2022-01-01T23:55:00.000Z',
gte: '2022-01-01T23:40:00.000Z',
lte: '2022-01-02T00:00:00.000Z',
},
},

View file

@ -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
// since timespan is hardcoded to 20m
expect(qc.timespanClause()).toEqual({
range: {
'monitor.timespan': {
// end date minus 5m
gte: new Date(Date.parse(rangeEnd) - 5 * 60 * 1000).toISOString(),
// end date minus 20
gte: new Date(Date.parse(rangeEnd) - 20 * 60 * 1000).toISOString(),
lte: rangeEnd,
},
},

View file

@ -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
@ -107,7 +107,7 @@ export class QueryContext {
return {
range: {
'monitor.timespan': {
gte: 'now-5m',
gte: 'now-20m',
lte: 'now',
},
},
@ -115,7 +115,7 @@ export class QueryContext {
}
const tsEnd = parseRelativeDate(this.dateRangeEnd, { roundUp: true })!;
const tsStart = moment(tsEnd).subtract(5, 'minutes');
const tsStart = moment(tsEnd).subtract(20, 'minutes');
return {
range: {