From fa01462487dac36febac123cb4db6f717c8790ee Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 31 Jul 2023 16:22:49 +0200 Subject: [PATCH] [Synthetics] Clean up common dir (#162692) --- .../common/constants/chart_format_limits.ts | 27 --- .../synthetics/common/constants/index.ts | 3 - .../synthetics/common/constants/query.ts | 28 --- .../synthetics/common/constants/rest_api.ts | 37 --- .../common/constants/synthetics/rest_api.ts | 7 + .../plugins/synthetics/common/constants/ui.ts | 15 -- .../common/constants/uptime_alerts.ts | 49 ---- .../assert_close_to.test.ts.snap | 3 - .../common/lib/assert_close_to.test.ts | 22 -- .../synthetics/common/lib/assert_close_to.ts | 17 -- .../common/lib/get_histogram_interval.test.ts | 21 -- .../common/lib/get_histogram_interval.ts | 46 ---- x-pack/plugins/synthetics/common/lib/index.ts | 2 - .../plugins/synthetics/common/lib/ml.test.ts | 35 --- x-pack/plugins/synthetics/common/lib/ml.ts | 28 --- .../common/rules/alert_actions.test.ts | 228 ------------------ .../synthetics/common/rules/alert_actions.ts | 66 +---- .../rules/legacy_uptime/translations.ts | 160 ------------ .../plugins/synthetics/common/translations.ts | 22 -- .../plugins/synthetics/common/types/index.ts | 2 - .../common/types/monitor_duration.ts | 26 -- .../common/utils/get_monitor_url.ts | 40 --- .../utils/get_synthetics_monitor_url.ts | 6 +- .../apps/synthetics/state/settings/api.ts | 8 +- x-pack/plugins/synthetics/server/feature.ts | 7 +- x-pack/plugins/synthetics/server/lib.ts | 4 +- .../translations/translations/fr-FR.json | 21 +- .../translations/translations/ja-JP.json | 21 +- .../translations/translations/zh-CN.json | 21 +- .../common/index.ts} | 4 +- .../observability/synthetics_rule.ts | 6 +- .../apis/uptime/feature_controls.ts | 2 +- .../apis/uptime/get_all_pings.ts | 2 +- .../apis/uptime/rest/dynamic_settings.ts | 4 +- .../apis/uptime/rest/index_status.ts | 2 +- .../apis/uptime/rest/monitor_duration.ts | 2 +- .../apis/uptime/rest/monitor_latest_status.ts | 2 +- .../uptime/rest/monitor_states_generated.ts | 2 +- .../uptime/rest/monitor_states_real_data.ts | 2 +- .../apis/uptime/rest/ping_histogram.ts | 2 +- .../apis/uptime/rest/ping_list.ts | 4 +- .../apis/uptime/rest/snapshot.ts | 2 +- .../uptime/simple_down_alert.ts | 2 +- 43 files changed, 57 insertions(+), 953 deletions(-) delete mode 100644 x-pack/plugins/synthetics/common/constants/chart_format_limits.ts delete mode 100644 x-pack/plugins/synthetics/common/constants/query.ts delete mode 100644 x-pack/plugins/synthetics/common/constants/rest_api.ts delete mode 100644 x-pack/plugins/synthetics/common/constants/uptime_alerts.ts delete mode 100644 x-pack/plugins/synthetics/common/lib/__snapshots__/assert_close_to.test.ts.snap delete mode 100644 x-pack/plugins/synthetics/common/lib/assert_close_to.test.ts delete mode 100644 x-pack/plugins/synthetics/common/lib/assert_close_to.ts delete mode 100644 x-pack/plugins/synthetics/common/lib/get_histogram_interval.test.ts delete mode 100644 x-pack/plugins/synthetics/common/lib/get_histogram_interval.ts delete mode 100644 x-pack/plugins/synthetics/common/lib/ml.test.ts delete mode 100644 x-pack/plugins/synthetics/common/lib/ml.ts delete mode 100644 x-pack/plugins/synthetics/common/rules/legacy_uptime/translations.ts delete mode 100644 x-pack/plugins/synthetics/common/translations.ts delete mode 100644 x-pack/plugins/synthetics/common/types/monitor_duration.ts delete mode 100644 x-pack/plugins/synthetics/common/utils/get_monitor_url.ts rename x-pack/plugins/{synthetics/common/types/integration_deprecation.ts => uptime/common/index.ts} (72%) diff --git a/x-pack/plugins/synthetics/common/constants/chart_format_limits.ts b/x-pack/plugins/synthetics/common/constants/chart_format_limits.ts deleted file mode 100644 index 44f1c5cd0c7d3c..00000000000000 --- a/x-pack/plugins/synthetics/common/constants/chart_format_limits.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -const MINUTE = 1000 * 60; -const HOUR = MINUTE * 60; -const DAY = 24 * 60 * 60 * 1000; -const WEEK = DAY * 7; -const MONTH = WEEK * 4; - -/** - * These constants are used by the charting code to determine - * what label should be applied to chart axes so as to help users - * understand the timeseries data they're being shown. - */ -export const CHART_FORMAT_LIMITS = { - DAY, - EIGHT_MINUTES: MINUTE * 8, - FOUR_YEARS: 4 * 12 * 4 * WEEK, - THIRTY_SIX_HOURS: HOUR * 36, - THREE_WEEKS: WEEK * 3, - SIX_MONTHS: MONTH * 7, - NINE_DAYS: DAY * 9, -}; diff --git a/x-pack/plugins/synthetics/common/constants/index.ts b/x-pack/plugins/synthetics/common/constants/index.ts index d94fa976fb5e06..46a415f8a41c65 100644 --- a/x-pack/plugins/synthetics/common/constants/index.ts +++ b/x-pack/plugins/synthetics/common/constants/index.ts @@ -5,12 +5,9 @@ * 2.0. */ -export { CHART_FORMAT_LIMITS } from './chart_format_limits'; export { CLIENT_DEFAULTS } from './client_defaults'; export { CONTEXT_DEFAULTS } from './context_defaults'; export * from './capabilities'; export * from './settings_defaults'; -export { QUERY } from './query'; export * from './ui'; -export * from './rest_api'; export * from './synthetics'; diff --git a/x-pack/plugins/synthetics/common/constants/query.ts b/x-pack/plugins/synthetics/common/constants/query.ts deleted file mode 100644 index 5bd376ae02393c..00000000000000 --- a/x-pack/plugins/synthetics/common/constants/query.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -/** - * These are the fields that will be used when users enter simple_query_string - * searches into the FilterBar component. - */ -export const QUERY = { - DEFAULT_BUCKET_COUNT: 25, - // the maximum buckets allowed by most aggregations - DEFAULT_AGGS_CAP: 10000, - SIMPLE_QUERY_STRING_FIELDS: [ - 'monitor.id', - 'monitor.url', - 'monitor.type', - 'monitor.status', - 'monitor.name', - 'url.full', - 'url.path', - 'url.scheme', - 'url.domain', - 'error.type', - ], -}; diff --git a/x-pack/plugins/synthetics/common/constants/rest_api.ts b/x-pack/plugins/synthetics/common/constants/rest_api.ts deleted file mode 100644 index 2499c178da1dba..00000000000000 --- a/x-pack/plugins/synthetics/common/constants/rest_api.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export enum API_URLS { - DYNAMIC_SETTINGS = `/internal/uptime/dynamic_settings`, - INDEX_STATUS = '/internal/uptime/index_status', - MONITOR_LIST = `/internal/uptime/monitor/list`, - MONITOR_LOCATIONS = `/internal/uptime/monitor/locations`, - MONITOR_DURATION = `/internal/uptime/monitor/duration`, - MONITOR_DETAILS = `/internal/uptime/monitor/details`, - MONITOR_STATUS = `/internal/uptime/monitor/status`, - NETWORK_EVENTS = `/internal/uptime/network_events`, - PINGS = '/internal/uptime/pings', - PING_HISTOGRAM = `/internal/uptime/ping/histogram`, - SNAPSHOT_COUNT = `/internal/uptime/snapshot/count`, - SYNTHETICS_SUCCESSFUL_CHECK = `/internal/uptime/synthetics/check/success`, - JOURNEY = `/internal/uptime/journey/{checkGroup}`, - JOURNEY_FAILED_STEPS = `/internal/uptime/journeys/failed_steps`, - JOURNEY_SCREENSHOT = `/internal/uptime/journey/screenshot/{checkGroup}/{stepIndex}`, - JOURNEY_SCREENSHOT_BLOCKS = `/internal/uptime/journey/screenshot/block`, - - ML_MODULE_JOBS = `/internal/ml/modules/jobs_exist/`, - ML_SETUP_MODULE = '/internal/ml/modules/setup/', - ML_DELETE_JOB = `/internal/ml/jobs/delete_jobs`, - ML_CAPABILITIES = '/internal/ml/ml_capabilities', - ML_ANOMALIES_RESULT = `/internal/ml/results/anomalies_table_data`, - - RULE_CONNECTORS = '/api/actions/connectors', - CREATE_RULE = '/api/alerting/rule', - DELETE_RULE = '/api/alerting/rule/', - RULES_FIND = '/api/alerting/rules/_find', - CONNECTOR_TYPES = '/api/actions/connector_types', -} diff --git a/x-pack/plugins/synthetics/common/constants/synthetics/rest_api.ts b/x-pack/plugins/synthetics/common/constants/synthetics/rest_api.ts index d43eb00d96b848..97f14b77f76658 100644 --- a/x-pack/plugins/synthetics/common/constants/synthetics/rest_api.ts +++ b/x-pack/plugins/synthetics/common/constants/synthetics/rest_api.ts @@ -45,4 +45,11 @@ export enum SYNTHETICS_API_URLS { SYNTHETICS_MONITORS_PROJECT = '/api/synthetics/project/{projectName}/monitors', SYNTHETICS_MONITORS_PROJECT_UPDATE = '/api/synthetics/project/{projectName}/monitors/_bulk_update', SYNTHETICS_MONITORS_PROJECT_DELETE = '/api/synthetics/project/{projectName}/monitors/_bulk_delete', + + DYNAMIC_SETTINGS = `/internal/uptime/dynamic_settings`, + RULE_CONNECTORS = '/api/actions/connectors', + CREATE_RULE = '/api/alerting/rule', + DELETE_RULE = '/api/alerting/rule/', + RULES_FIND = '/api/alerting/rules/_find', + CONNECTOR_TYPES = '/api/actions/connector_types', } diff --git a/x-pack/plugins/synthetics/common/constants/ui.ts b/x-pack/plugins/synthetics/common/constants/ui.ts index 189dd40660ae7b..64259a676189c6 100644 --- a/x-pack/plugins/synthetics/common/constants/ui.ts +++ b/x-pack/plugins/synthetics/common/constants/ui.ts @@ -42,8 +42,6 @@ export const SYNTHETIC_CHECK_STEPS_ROUTE = '/journey/:checkGroupId/steps'; export const TEST_RUN_DETAILS_ROUTE = '/monitor/:monitorId/test-run/:checkGroupId'; -export const MAPPING_ERROR_ROUTE = '/mapping-error'; - export const ERROR_DETAILS_ROUTE = '/monitor/:monitorId/errors/:errorStateId'; export enum STATUS { @@ -61,10 +59,6 @@ export enum MONITOR_TYPES { BROWSER = 'browser', } -export const ML_JOB_ID = 'high_latency_by_geo'; - -export const ML_MODULE_ID = 'uptime_heartbeat'; - export const UNNAMED_LOCATION = 'Unnamed-location'; export enum CERT_STATUS { @@ -74,15 +68,6 @@ export enum CERT_STATUS { TOO_OLD = 'TOO_OLD', } -export const KQL_SYNTAX_LOCAL_STORAGE = 'xpack.uptime.kql.syntax'; - -export const FILTER_FIELDS = { - TAGS: 'tags', - PORT: 'url.port', - LOCATION: 'observer.geo.name', - TYPE: 'monitor.type', -}; - export const SYNTHETICS_INDEX_PATTERN = 'synthetics-*'; export const LICENSE_NOT_ACTIVE_ERROR = 'License not active'; diff --git a/x-pack/plugins/synthetics/common/constants/uptime_alerts.ts b/x-pack/plugins/synthetics/common/constants/uptime_alerts.ts deleted file mode 100644 index 71f6bd1b183fb1..00000000000000 --- a/x-pack/plugins/synthetics/common/constants/uptime_alerts.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { ActionGroup } from '@kbn/alerting-plugin/common'; - -export type MonitorStatusActionGroup = - ActionGroup<'xpack.uptime.alerts.actionGroups.monitorStatus'>; -export type TLSLegacyActionGroup = ActionGroup<'xpack.uptime.alerts.actionGroups.tls'>; -export type TLSActionGroup = ActionGroup<'xpack.uptime.alerts.actionGroups.tlsCertificate'>; -export type DurationAnomalyActionGroup = - ActionGroup<'xpack.uptime.alerts.actionGroups.durationAnomaly'>; - -export const MONITOR_STATUS: MonitorStatusActionGroup = { - id: 'xpack.uptime.alerts.actionGroups.monitorStatus', - name: 'Uptime Down Monitor', -}; - -export const TLS_LEGACY: TLSLegacyActionGroup = { - id: 'xpack.uptime.alerts.actionGroups.tls', - name: 'Uptime TLS Alert (Legacy)', -}; - -export const TLS: TLSActionGroup = { - id: 'xpack.uptime.alerts.actionGroups.tlsCertificate', - name: 'Uptime TLS Alert', -}; - -export const DURATION_ANOMALY: DurationAnomalyActionGroup = { - id: 'xpack.uptime.alerts.actionGroups.durationAnomaly', - name: 'Uptime Duration Anomaly', -}; - -export const CLIENT_ALERT_TYPES = { - MONITOR_STATUS: 'xpack.uptime.alerts.monitorStatus', - TLS_LEGACY: 'xpack.uptime.alerts.tls', - TLS: 'xpack.uptime.alerts.tlsCertificate', - DURATION_ANOMALY: 'xpack.uptime.alerts.durationAnomaly', -}; - -export const UPTIME_RULE_TYPES = [ - 'xpack.uptime.alerts.tls', - 'xpack.uptime.alerts.tlsCertificate', - 'xpack.uptime.alerts.monitorStatus', - 'xpack.uptime.alerts.durationAnomaly', -]; diff --git a/x-pack/plugins/synthetics/common/lib/__snapshots__/assert_close_to.test.ts.snap b/x-pack/plugins/synthetics/common/lib/__snapshots__/assert_close_to.test.ts.snap deleted file mode 100644 index 7dfb8c88be1ca4..00000000000000 --- a/x-pack/plugins/synthetics/common/lib/__snapshots__/assert_close_to.test.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`assertCloseTo throws an error when expected value is outside of precision range 1`] = `"expected [12500] to be within 100 of 10000"`; diff --git a/x-pack/plugins/synthetics/common/lib/assert_close_to.test.ts b/x-pack/plugins/synthetics/common/lib/assert_close_to.test.ts deleted file mode 100644 index 1a8a2e4cddb3a7..00000000000000 --- a/x-pack/plugins/synthetics/common/lib/assert_close_to.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { assertCloseTo } from './assert_close_to'; - -describe('assertCloseTo', () => { - it('does not throw an error when expected value is correct', () => { - assertCloseTo(10000, 10001, 100); - }); - - it('does not throw an error when expected value is under actual, but within precision threshold', () => { - assertCloseTo(10000, 9875, 300); - }); - - it('throws an error when expected value is outside of precision range', () => { - expect(() => assertCloseTo(10000, 12500, 100)).toThrowErrorMatchingSnapshot(); - }); -}); diff --git a/x-pack/plugins/synthetics/common/lib/assert_close_to.ts b/x-pack/plugins/synthetics/common/lib/assert_close_to.ts deleted file mode 100644 index eeadacaa5703ac..00000000000000 --- a/x-pack/plugins/synthetics/common/lib/assert_close_to.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export const assertCloseTo = (actual: number, expected: number, precision: number) => { - if (Math.abs(expected - actual) > precision) { - throw new Error(`expected [${expected}] to be within ${precision} of ${actual}`); - } - - // if actual is undefined above math condition will be NAN and it will be always false - if (actual === undefined) { - throw new Error(`expected close to [${expected}] but got [${actual}]`); - } -}; diff --git a/x-pack/plugins/synthetics/common/lib/get_histogram_interval.test.ts b/x-pack/plugins/synthetics/common/lib/get_histogram_interval.test.ts deleted file mode 100644 index 5c5f5415ff23e3..00000000000000 --- a/x-pack/plugins/synthetics/common/lib/get_histogram_interval.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { getHistogramInterval } from './get_histogram_interval'; -import { assertCloseTo } from './assert_close_to'; - -describe('getHistogramInterval', () => { - it('specifies the interval necessary to divide a given timespan into equal buckets, rounded to the nearest integer, expressed in ms', () => { - const interval = getHistogramInterval('now-15m', 'now', 10); - assertCloseTo(interval, 90000, 20); - }); - - it('will supply a default constant value for bucketCount when none is provided', () => { - const interval = getHistogramInterval('now-15m', 'now'); - assertCloseTo(interval, 36000, 20); - }); -}); diff --git a/x-pack/plugins/synthetics/common/lib/get_histogram_interval.ts b/x-pack/plugins/synthetics/common/lib/get_histogram_interval.ts deleted file mode 100644 index 8d44fb594c03a1..00000000000000 --- a/x-pack/plugins/synthetics/common/lib/get_histogram_interval.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import DateMath from '@kbn/datemath'; -import { QUERY } from '../constants'; - -export const parseRelativeDate = (dateStr: string, options = {}) => { - // We need this this parsing because if user selects This week or this date - // That represents end date in future, if week or day is still in the middle - // Uptime data can never be collected in future, so we will reset date to now - // in That case. Example case we select this week range will be to='now/w' and from = 'now/w'; - - const parsedDate = DateMath.parse(dateStr, options); - const dateTimestamp = parsedDate?.valueOf() ?? 0; - if (dateTimestamp > Date.now()) { - return DateMath.parse('now'); - } - return parsedDate; -}; - -export const getHistogramInterval = ( - dateRangeStart: string, - dateRangeEnd: string, - bucketCount?: number -): number => { - const from = parseRelativeDate(dateRangeStart); - - // roundUp is required for relative date like now/w to get the end of the week - const to = parseRelativeDate(dateRangeEnd, { roundUp: true }); - if (from === undefined) { - throw Error('Invalid dateRangeStart value'); - } - if (to === undefined) { - throw Error('Invalid dateRangeEnd value'); - } - const interval = Math.round( - (to.valueOf() - from.valueOf()) / (bucketCount || QUERY.DEFAULT_BUCKET_COUNT) - ); - - // Interval can never be zero, if it's 0 we return at least 1ms interval - return interval > 0 ? interval : 1; -}; diff --git a/x-pack/plugins/synthetics/common/lib/index.ts b/x-pack/plugins/synthetics/common/lib/index.ts index 497284f3fa281a..c0a2226d59b939 100644 --- a/x-pack/plugins/synthetics/common/lib/index.ts +++ b/x-pack/plugins/synthetics/common/lib/index.ts @@ -7,5 +7,3 @@ export * from './combine_filters_and_user_search'; export * from './stringify_kueries'; - -export { getMLJobId } from './ml'; diff --git a/x-pack/plugins/synthetics/common/lib/ml.test.ts b/x-pack/plugins/synthetics/common/lib/ml.test.ts deleted file mode 100644 index e7f572b12bb470..00000000000000 --- a/x-pack/plugins/synthetics/common/lib/ml.test.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { getMLJobId } from './ml'; - -describe('ML Anomaly API', () => { - it('it generates a lowercase job id', async () => { - const monitorId = 'ABC1334haa'; - - const jobId = getMLJobId(monitorId); - - expect(jobId).toEqual(jobId.toLowerCase()); - }); - - it('should truncate long monitor IDs', () => { - const longAndWeirdMonitorId = - 'https://auto-mmmmxhhhhhccclongAndWeirdMonitorId123yyyyyrereauto-xcmpa-1345555454646'; - - expect(getMLJobId(longAndWeirdMonitorId)).toHaveLength(64); - }); - - it('should remove special characters and replace them with underscore', () => { - const monIdSpecialChars = '/ ? , " < > | * a'; - - const jobId = getMLJobId(monIdSpecialChars); - - const format = /[/?,"<>|*]+/; - - expect(format.test(jobId)).toBe(false); - }); -}); diff --git a/x-pack/plugins/synthetics/common/lib/ml.ts b/x-pack/plugins/synthetics/common/lib/ml.ts deleted file mode 100644 index 8b9c4bf7c5857b..00000000000000 --- a/x-pack/plugins/synthetics/common/lib/ml.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { ML_JOB_ID } from '../constants'; - -export const getJobPrefix = (monitorId: string) => { - // ML App doesn't support upper case characters in job name - // Also Spaces and the characters / ? , " < > | * are not allowed - // so we will replace all special chars with _ - - const prefix = monitorId.replace(/[^A-Z0-9]+/gi, '_').toLowerCase(); - - // ML Job ID can't be greater than 64 length, so will be substring it, and hope - // At such big length, there is minimum chance of having duplicate monitor id - // Subtracting ML_JOB_ID constant as well - const postfix = '_' + ML_JOB_ID; - - if ((prefix + postfix).length > 64) { - return prefix.substring(0, 64 - postfix.length) + '_'; - } - return prefix + '_'; -}; - -export const getMLJobId = (monitorId: string) => `${getJobPrefix(monitorId)}${ML_JOB_ID}`; diff --git a/x-pack/plugins/synthetics/common/rules/alert_actions.test.ts b/x-pack/plugins/synthetics/common/rules/alert_actions.test.ts index 3315f5059ef86e..345342d1f4c629 100644 --- a/x-pack/plugins/synthetics/common/rules/alert_actions.test.ts +++ b/x-pack/plugins/synthetics/common/rules/alert_actions.test.ts @@ -7,237 +7,9 @@ import { populateAlertActions } from './alert_actions'; import { ActionConnector } from './types'; -import { MONITOR_STATUS } from '../constants/uptime_alerts'; import { MONITOR_STATUS as SYNTHETICS_MONITOR_STATUS } from '../constants/synthetics_alerts'; -import { MonitorStatusTranslations } from './legacy_uptime/translations'; import { SyntheticsMonitorStatusTranslations } from './synthetics/translations'; -describe('Legacy Alert Actions factory', () => { - it('generate expected action for pager duty', async () => { - const resp = populateAlertActions({ - groupId: MONITOR_STATUS.id, - defaultActions: [ - { - actionTypeId: '.pagerduty', - group: 'xpack.uptime.alerts.actionGroups.monitorStatus', - params: { - dedupKey: 'always-downxpack.uptime.alerts.actionGroups.monitorStatus', - eventAction: 'trigger', - severity: 'error', - summary: MonitorStatusTranslations.defaultActionMessage, - }, - id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', - }, - ] as unknown as ActionConnector[], - translations: { - defaultActionMessage: MonitorStatusTranslations.defaultActionMessage, - defaultRecoveryMessage: MonitorStatusTranslations.defaultRecoveryMessage, - defaultSubjectMessage: MonitorStatusTranslations.defaultSubjectMessage, - defaultRecoverySubjectMessage: MonitorStatusTranslations.defaultRecoverySubjectMessage, - }, - isLegacy: true, - }); - expect(resp).toEqual([ - { - group: 'recovered', - id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', - params: { - dedupKey: expect.any(String), - eventAction: 'resolve', - summary: - 'Alert for monitor {{context.monitorName}} with url {{{context.monitorUrl}}} from {{context.observerLocation}} has recovered', - }, - }, - { - group: 'xpack.uptime.alerts.actionGroups.monitorStatus', - id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', - params: { - dedupKey: expect.any(String), - eventAction: 'trigger', - severity: 'error', - summary: MonitorStatusTranslations.defaultActionMessage, - }, - }, - ]); - }); - - it('generate expected action for email', async () => { - const resp = populateAlertActions({ - groupId: MONITOR_STATUS.id, - defaultActions: [ - { - actionTypeId: '.email', - group: 'xpack.uptime.alerts.actionGroups.monitorStatus', - params: { - dedupKey: 'always-downxpack.uptime.alerts.actionGroups.monitorStatus', - eventAction: 'trigger', - severity: 'error', - summary: MonitorStatusTranslations.defaultActionMessage, - }, - id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', - }, - ] as unknown as ActionConnector[], - translations: { - defaultActionMessage: MonitorStatusTranslations.defaultActionMessage, - defaultRecoveryMessage: MonitorStatusTranslations.defaultRecoveryMessage, - defaultSubjectMessage: MonitorStatusTranslations.defaultSubjectMessage, - defaultRecoverySubjectMessage: MonitorStatusTranslations.defaultRecoverySubjectMessage, - }, - isLegacy: true, - defaultEmail: { - to: ['test@email.com'], - }, - }); - expect(resp).toEqual([ - { - group: 'recovered', - id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', - params: { - bcc: [], - cc: [], - kibanaFooterLink: { - path: '', - text: '', - }, - message: - 'Alert for monitor {{context.monitorName}} with url {{{context.monitorUrl}}} from {{context.observerLocation}} has recovered', - messageHTML: null, - subject: - 'Monitor {{context.monitorName}} with url {{{context.monitorUrl}}} has recovered', - to: ['test@email.com'], - }, - }, - { - group: 'xpack.uptime.alerts.actionGroups.monitorStatus', - id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', - params: { - bcc: [], - cc: [], - kibanaFooterLink: { - path: '', - text: '', - }, - message: - 'Monitor {{context.monitorName}} with url {{{context.monitorUrl}}} from {{context.observerLocation}} {{{context.statusMessage}}} The latest error message is {{{context.latestErrorMessage}}}, checked at {{context.checkedAt}}', - messageHTML: null, - subject: 'Monitor {{context.monitorName}} with url {{{context.monitorUrl}}} is down', - to: ['test@email.com'], - }, - }, - ]); - }); - - it('generate expected action for index', async () => { - const resp = populateAlertActions({ - groupId: MONITOR_STATUS.id, - defaultActions: [ - { - actionTypeId: '.index', - group: 'xpack.uptime.alerts.actionGroups.monitorStatus', - params: { - dedupKey: 'always-downxpack.uptime.alerts.actionGroups.monitorStatus', - eventAction: 'trigger', - severity: 'error', - summary: MonitorStatusTranslations.defaultActionMessage, - }, - id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', - }, - ] as unknown as ActionConnector[], - translations: { - defaultActionMessage: MonitorStatusTranslations.defaultActionMessage, - defaultRecoveryMessage: MonitorStatusTranslations.defaultRecoveryMessage, - defaultSubjectMessage: MonitorStatusTranslations.defaultSubjectMessage, - defaultRecoverySubjectMessage: MonitorStatusTranslations.defaultRecoverySubjectMessage, - }, - isLegacy: true, - }); - expect(resp).toEqual([ - { - group: 'recovered', - id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', - params: { - documents: [ - { - latestErrorMessage: '', - monitorName: '{{context.monitorName}}', - monitorUrl: '{{{context.monitorUrl}}}', - observerLocation: '{{context.observerLocation}}', - statusMessage: - 'Alert for monitor {{context.monitorName}} with url {{{context.monitorUrl}}} from {{context.observerLocation}} has recovered', - }, - ], - indexOverride: null, - }, - }, - { - group: 'xpack.uptime.alerts.actionGroups.monitorStatus', - id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', - params: { - documents: [ - { - latestErrorMessage: '{{{context.latestErrorMessage}}}', - monitorName: '{{context.monitorName}}', - monitorUrl: '{{{context.monitorUrl}}}', - observerLocation: '{{context.observerLocation}}', - statusMessage: '{{{context.statusMessage}}}', - }, - ], - indexOverride: null, - }, - }, - ]); - }); - - it('generate expected action for slack action connector', async () => { - const resp = populateAlertActions({ - groupId: MONITOR_STATUS.id, - defaultActions: [ - { - actionTypeId: '.pagerduty', - group: 'xpack.uptime.alerts.actionGroups.monitorStatus', - params: { - dedupKey: 'always-downxpack.uptime.alerts.actionGroups.monitorStatus', - eventAction: 'trigger', - severity: 'error', - summary: - 'Monitor {{context.monitorName}} with url {{{context.monitorUrl}}} from {{context.observerLocation}} {{{context.statusMessage}}} The latest error message is {{{context.latestErrorMessage}}}', - }, - id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', - }, - ] as unknown as ActionConnector[], - translations: { - defaultActionMessage: MonitorStatusTranslations.defaultActionMessage, - defaultRecoveryMessage: MonitorStatusTranslations.defaultRecoveryMessage, - defaultSubjectMessage: MonitorStatusTranslations.defaultSubjectMessage, - defaultRecoverySubjectMessage: MonitorStatusTranslations.defaultRecoverySubjectMessage, - }, - isLegacy: true, - }); - expect(resp).toEqual([ - { - group: 'recovered', - id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', - params: { - dedupKey: expect.any(String), - eventAction: 'resolve', - summary: - 'Alert for monitor {{context.monitorName}} with url {{{context.monitorUrl}}} from {{context.observerLocation}} has recovered', - }, - }, - { - group: 'xpack.uptime.alerts.actionGroups.monitorStatus', - id: 'f2a3b195-ed76-499a-805d-82d24d4eeba9', - params: { - dedupKey: expect.any(String), - eventAction: 'trigger', - severity: 'error', - summary: MonitorStatusTranslations.defaultActionMessage, - }, - }, - ]); - }); -}); - describe('Alert Actions factory', () => { it('generate expected action for pager duty', async () => { const resp = populateAlertActions({ diff --git a/x-pack/plugins/synthetics/common/rules/alert_actions.ts b/x-pack/plugins/synthetics/common/rules/alert_actions.ts index 70a2de4d7cf592..02402c8eed944e 100644 --- a/x-pack/plugins/synthetics/common/rules/alert_actions.ts +++ b/x-pack/plugins/synthetics/common/rules/alert_actions.ts @@ -44,13 +44,11 @@ export function populateAlertActions({ defaultEmail, groupId, translations, - isLegacy = false, }: { groupId: string; defaultActions: ActionConnector[]; defaultEmail?: DefaultEmail; translations: Translations; - isLegacy?: boolean; }) { const actions: RuleAction[] = []; defaultActions.forEach((aId) => { @@ -58,13 +56,11 @@ export function populateAlertActions({ id: aId.id, group: groupId, params: {}, - frequency: !isLegacy - ? { - notifyWhen: 'onActionGroupChange', - throttle: null, - summary: false, - } - : undefined, + frequency: { + notifyWhen: 'onActionGroupChange', + throttle: null, + summary: false, + }, }; const recoveredAction: RuleAction = { @@ -73,13 +69,11 @@ export function populateAlertActions({ params: { message: translations.defaultRecoveryMessage, }, - frequency: !isLegacy - ? { - notifyWhen: 'onActionGroupChange', - throttle: null, - summary: false, - } - : undefined, + frequency: { + notifyWhen: 'onActionGroupChange', + throttle: null, + summary: false, + }, }; switch (aId.actionTypeId) { @@ -95,8 +89,8 @@ export function populateAlertActions({ actions.push(recoveredAction); break; case INDEX_ACTION_ID: - action.params = getIndexActionParams(translations, false, isLegacy); - recoveredAction.params = getIndexActionParams(translations, true, isLegacy); + action.params = getIndexActionParams(translations, false); + recoveredAction.params = getIndexActionParams(translations, true); actions.push(recoveredAction); break; case SERVICE_NOW_ACTION_ID: @@ -138,41 +132,7 @@ export function populateAlertActions({ return actions; } -function getIndexActionParams( - translations: Translations, - recovery = false, - isLegacy = false -): IndexActionParams { - if (isLegacy && recovery) { - return { - documents: [ - { - monitorName: '{{context.monitorName}}', - monitorUrl: '{{{context.monitorUrl}}}', - statusMessage: translations.defaultRecoveryMessage, - latestErrorMessage: '', - observerLocation: '{{context.observerLocation}}', - }, - ], - indexOverride: null, - }; - } - - if (isLegacy) { - return { - documents: [ - { - monitorName: '{{context.monitorName}}', - monitorUrl: '{{{context.monitorUrl}}}', - statusMessage: '{{{context.statusMessage}}}', - latestErrorMessage: '{{{context.latestErrorMessage}}}', - observerLocation: '{{context.observerLocation}}', - }, - ], - indexOverride: null, - }; - } - +function getIndexActionParams(translations: Translations, recovery = false): IndexActionParams { if (recovery) { return { documents: [ diff --git a/x-pack/plugins/synthetics/common/rules/legacy_uptime/translations.ts b/x-pack/plugins/synthetics/common/rules/legacy_uptime/translations.ts deleted file mode 100644 index fab705daeb0c0f..00000000000000 --- a/x-pack/plugins/synthetics/common/rules/legacy_uptime/translations.ts +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { i18n } from '@kbn/i18n'; - -export const MonitorStatusTranslations = { - defaultActionMessage: i18n.translate( - 'xpack.synthetics.alerts.monitorStatus.defaultActionMessage', - { - defaultMessage: - 'Monitor {monitorName} with url {monitorUrl} from {observerLocation} {statusMessage} The latest error message is {latestErrorMessage}, checked at {checkedAt}', - values: { - monitorName: '{{context.monitorName}}', - monitorUrl: '{{{context.monitorUrl}}}', - statusMessage: '{{{context.statusMessage}}}', - latestErrorMessage: '{{{context.latestErrorMessage}}}', - observerLocation: '{{context.observerLocation}}', - checkedAt: '{{context.checkedAt}}', - }, - } - ), - defaultSubjectMessage: i18n.translate( - 'xpack.synthetics.alerts.monitorStatus.defaultSubjectMessage', - { - defaultMessage: 'Monitor {monitorName} with url {monitorUrl} is down', - values: { - monitorName: '{{context.monitorName}}', - monitorUrl: '{{{context.monitorUrl}}}', - }, - } - ), - defaultRecoverySubjectMessage: i18n.translate( - 'xpack.synthetics.alerts.monitorStatus.defaultRecoverySubjectMessage', - { - defaultMessage: 'Monitor {monitorName} with url {monitorUrl} has recovered', - values: { - monitorName: '{{context.monitorName}}', - monitorUrl: '{{{context.monitorUrl}}}', - }, - } - ), - defaultRecoveryMessage: i18n.translate( - 'xpack.synthetics.alerts.monitorStatus.defaultRecoveryMessage', - { - defaultMessage: - 'Alert for monitor {monitorName} with url {monitorUrl} from {observerLocation} has recovered', - values: { - monitorName: '{{context.monitorName}}', - monitorUrl: '{{{context.monitorUrl}}}', - observerLocation: '{{context.observerLocation}}', - }, - } - ), - name: i18n.translate('xpack.synthetics.alerts.monitorStatus.clientName', { - defaultMessage: 'Uptime monitor status', - }), - description: i18n.translate('xpack.synthetics.alerts.monitorStatus.description', { - defaultMessage: 'Alert when a monitor is down or an availability threshold is breached.', - }), -}; - -export const TlsTranslations = { - defaultActionMessage: i18n.translate('xpack.synthetics.alerts.tls.defaultActionMessage', { - defaultMessage: `Detected TLS certificate {commonName} from issuer {issuer} is {status}. Certificate {summary}`, - values: { - commonName: '{{context.commonName}}', - issuer: '{{context.issuer}}', - summary: '{{context.summary}}', - status: '{{context.status}}', - }, - }), - defaultRecoveryMessage: i18n.translate('xpack.synthetics.alerts.tls.defaultRecoveryMessage', { - defaultMessage: `Alert for TLS certificate {commonName} from issuer {issuer} has recovered`, - values: { - commonName: '{{context.commonName}}', - issuer: '{{context.issuer}}', - }, - }), - name: i18n.translate('xpack.synthetics.alerts.tls.clientName', { - defaultMessage: 'Uptime TLS', - }), - description: i18n.translate('xpack.synthetics.alerts.tls.description', { - defaultMessage: 'Alert when the TLS certificate of an Uptime monitor is about to expire.', - }), -}; - -export const TlsTranslationsLegacy = { - defaultActionMessage: i18n.translate('xpack.synthetics.alerts.tls.legacy.defaultActionMessage', { - defaultMessage: `Detected {count} TLS certificates expiring or becoming too old. -{expiringConditionalOpen} -Expiring cert count: {expiringCount} -Expiring Certificates: {expiringCommonNameAndDate} -{expiringConditionalClose} -{agingConditionalOpen} -Aging cert count: {agingCount} -Aging Certificates: {agingCommonNameAndDate} -{agingConditionalClose} -`, - values: { - count: '{{state.count}}', - expiringCount: '{{state.expiringCount}}', - expiringCommonNameAndDate: '{{state.expiringCommonNameAndDate}}', - expiringConditionalOpen: '{{#state.hasExpired}}', - expiringConditionalClose: '{{/state.hasExpired}}', - agingCount: '{{state.agingCount}}', - agingCommonNameAndDate: '{{state.agingCommonNameAndDate}}', - agingConditionalOpen: '{{#state.hasAging}}', - agingConditionalClose: '{{/state.hasAging}}', - }, - }), - name: i18n.translate('xpack.synthetics.alerts.tls.legacy.clientName', { - defaultMessage: 'Uptime TLS (Legacy)', - }), - description: i18n.translate('xpack.synthetics.alerts.tls.legacy.description', { - defaultMessage: - 'Alert when the TLS certificate of an Uptime monitor is about to expire. This alert will be deprecated in a future version.', - }), -}; - -export const DurationAnomalyTranslations = { - defaultActionMessage: i18n.translate( - 'xpack.synthetics.alerts.durationAnomaly.defaultActionMessage', - { - defaultMessage: `Abnormal ({severity} level) response time detected on {monitor} with url {monitorUrl} at {anomalyStartTimestamp}. Anomaly severity score is {severityScore}. -Response times as high as {slowestAnomalyResponse} have been detected from location {observerLocation}. Expected response time is {expectedResponseTime}.`, - values: { - severity: '{{context.severity}}', - anomalyStartTimestamp: '{{context.anomalyStartTimestamp}}', - monitor: '{{context.monitor}}', - monitorUrl: '{{{context.monitorUrl}}}', - slowestAnomalyResponse: '{{context.slowestAnomalyResponse}}', - expectedResponseTime: '{{context.expectedResponseTime}}', - severityScore: '{{context.severityScore}}', - observerLocation: '{{context.observerLocation}}', - }, - } - ), - defaultRecoveryMessage: i18n.translate( - 'xpack.synthetics.alerts.durationAnomaly.defaultRecoveryMessage', - { - defaultMessage: `Alert for abnormal ({severity} level) response time detected on monitor {monitor} with url {monitorUrl} from location {observerLocation} at {anomalyStartTimestamp} has recovered`, - values: { - severity: '{{context.severity}}', - anomalyStartTimestamp: '{{context.anomalyStartTimestamp}}', - monitor: '{{context.monitor}}', - monitorUrl: '{{{context.monitorUrl}}}', - observerLocation: '{{context.observerLocation}}', - }, - } - ), - name: i18n.translate('xpack.synthetics.alerts.durationAnomaly.clientName', { - defaultMessage: 'Uptime Duration Anomaly', - }), - description: i18n.translate('xpack.synthetics.alerts.durationAnomaly.description', { - defaultMessage: 'Alert when the Uptime monitor duration is anomalous.', - }), -}; diff --git a/x-pack/plugins/synthetics/common/translations.ts b/x-pack/plugins/synthetics/common/translations.ts deleted file mode 100644 index ac2bec7a5506b4..00000000000000 --- a/x-pack/plugins/synthetics/common/translations.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; - -export const VALUE_MUST_BE_GREATER_THAN_ZERO = i18n.translate( - 'xpack.synthetics.settings.invalid.error', - { - defaultMessage: 'Value must be greater than 0.', - } -); - -export const VALUE_MUST_BE_AN_INTEGER = i18n.translate( - 'xpack.synthetics.settings.invalid.nanError', - { - defaultMessage: 'Value must be an integer.', - } -); diff --git a/x-pack/plugins/synthetics/common/types/index.ts b/x-pack/plugins/synthetics/common/types/index.ts index 6a864b700092dc..2a70803a432115 100644 --- a/x-pack/plugins/synthetics/common/types/index.ts +++ b/x-pack/plugins/synthetics/common/types/index.ts @@ -5,7 +5,5 @@ * 2.0. */ -export * from './monitor_duration'; export * from './synthetics_monitor'; export * from './monitor_validation'; -export * from './integration_deprecation'; diff --git a/x-pack/plugins/synthetics/common/types/monitor_duration.ts b/x-pack/plugins/synthetics/common/types/monitor_duration.ts deleted file mode 100644 index 253adba03cdcf7..00000000000000 --- a/x-pack/plugins/synthetics/common/types/monitor_duration.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -/** Represents the average monitor duration ms at a point in time. */ -export interface MonitorDurationAveragePoint { - /** The timeseries value for this point. */ - x: number; - /** The average duration ms for the monitor. */ - y?: number | null; -} - -export interface LocationDurationLine { - name: string; - - line: MonitorDurationAveragePoint[]; -} - -/** The data used to populate the monitor charts. */ -export interface MonitorDurationResult { - /** The average values for the monitor duration. */ - locationDurationLines: LocationDurationLine[]; -} diff --git a/x-pack/plugins/synthetics/common/utils/get_monitor_url.ts b/x-pack/plugins/synthetics/common/utils/get_monitor_url.ts deleted file mode 100644 index 09b02150957d03..00000000000000 --- a/x-pack/plugins/synthetics/common/utils/get_monitor_url.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { stringify } from 'querystring'; - -export const format = ({ - pathname, - query, -}: { - pathname: string; - query: Record; -}): string => { - return `${pathname}?${stringify(query)}`; -}; - -export const getMonitorRouteFromMonitorId = ({ - monitorId, - dateRangeStart, - dateRangeEnd, - filters = {}, -}: { - monitorId: string; - dateRangeStart: string; - dateRangeEnd: string; - filters?: Record; -}) => - format({ - pathname: `/app/uptime/monitor/${btoa(monitorId)}`, - query: { - dateRangeEnd, - dateRangeStart, - ...(Object.keys(filters).length - ? { filters: JSON.stringify(Object.keys(filters).map((key) => [key, filters[key]])) } - : {}), - }, - }); diff --git a/x-pack/plugins/synthetics/common/utils/get_synthetics_monitor_url.ts b/x-pack/plugins/synthetics/common/utils/get_synthetics_monitor_url.ts index 007b0c5812dcea..7bd962b0b16403 100644 --- a/x-pack/plugins/synthetics/common/utils/get_synthetics_monitor_url.ts +++ b/x-pack/plugins/synthetics/common/utils/get_synthetics_monitor_url.ts @@ -4,9 +4,11 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import { stringify } from 'querystring'; -import { format } from './get_monitor_url'; - +const format = ({ pathname, query }: { pathname: string; query: Record }): string => { + return `${pathname}?${stringify(query)}`; +}; export const getSyntheticsErrorRouteFromMonitorId = ({ configId, stateId, diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/settings/api.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/settings/api.ts index da8855f531ef9d..b5430aae3239de 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/settings/api.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/settings/api.ts @@ -19,10 +19,10 @@ import { LocationMonitorsResponse, LocationMonitorsType, } from '../../../../../common/runtime_types'; -import { API_URLS, SYNTHETICS_API_URLS } from '../../../../../common/constants'; +import { SYNTHETICS_API_URLS } from '../../../../../common/constants'; import { LocationMonitor } from '.'; -const apiPath = API_URLS.DYNAMIC_SETTINGS; +const apiPath = SYNTHETICS_API_URLS.DYNAMIC_SETTINGS; interface SaveApiRequest { settings: DynamicSettings; @@ -51,7 +51,7 @@ export const fetchLocationMonitors = async (): Promise => { export type ActionConnector = Omit; export const fetchConnectors = async (): Promise => { - const response = (await apiService.get(API_URLS.RULE_CONNECTORS)) as Array< + const response = (await apiService.get(SYNTHETICS_API_URLS.RULE_CONNECTORS)) as Array< AsApiContract >; return response.map( @@ -76,7 +76,7 @@ export const fetchConnectors = async (): Promise => { }; export const fetchActionTypes = async (): Promise => { - const response = (await apiService.get(API_URLS.CONNECTOR_TYPES, { + const response = (await apiService.get(SYNTHETICS_API_URLS.CONNECTOR_TYPES, { feature_id: 'uptime', })) as Array>; return response.map( diff --git a/x-pack/plugins/synthetics/server/feature.ts b/x-pack/plugins/synthetics/server/feature.ts index ac5bce8a6b790d..265def5c3fa013 100644 --- a/x-pack/plugins/synthetics/server/feature.ts +++ b/x-pack/plugins/synthetics/server/feature.ts @@ -10,10 +10,15 @@ import { syntheticsMonitorType, syntheticsParamType } from '../common/types/save import { SYNTHETICS_RULE_TYPES } from '../common/constants/synthetics_alerts'; import { privateLocationsSavedObjectName } from '../common/saved_objects/private_locations'; import { PLUGIN } from '../common/constants/plugin'; -import { UPTIME_RULE_TYPES } from '../common/constants/uptime_alerts'; import { settingsObjectType } from './saved_objects/uptime_settings'; import { syntheticsApiKeyObjectType } from './saved_objects/service_api_key'; +const UPTIME_RULE_TYPES = [ + 'xpack.uptime.alerts.tls', + 'xpack.uptime.alerts.tlsCertificate', + 'xpack.uptime.alerts.monitorStatus', + 'xpack.uptime.alerts.durationAnomaly', +]; export const uptimeFeature = { id: PLUGIN.ID, name: PLUGIN.NAME, diff --git a/x-pack/plugins/synthetics/server/lib.ts b/x-pack/plugins/synthetics/server/lib.ts index 9a7c280d3434eb..4dc06bc7b9674f 100644 --- a/x-pack/plugins/synthetics/server/lib.ts +++ b/x-pack/plugins/synthetics/server/lib.ts @@ -18,7 +18,7 @@ import { RequestStatus } from '@kbn/inspector-plugin/common'; import { InspectResponse } from '@kbn/observability-plugin/typings/common'; import { enableInspectEsQueries } from '@kbn/observability-plugin/common'; import { getInspectResponse } from '@kbn/observability-shared-plugin/common'; -import { API_URLS } from '../common/constants'; +import { SYNTHETICS_API_URLS } from '../common/constants'; import { SyntheticsServerSetup } from './types'; import { savedObjectsAdapter } from './saved_objects/saved_objects'; @@ -168,7 +168,7 @@ export class UptimeEsClient { async getInspectData(path: string) { const isInspectorEnabled = await this.getInspectEnabled(); const showInspectData = - (isInspectorEnabled || this.isDev) && path !== API_URLS.DYNAMIC_SETTINGS; + (isInspectorEnabled || this.isDev) && path !== SYNTHETICS_API_URLS.DYNAMIC_SETTINGS; if (showInspectData) { return { _inspect: this.inspectableEsQueries }; diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 64ffa9ac501f52..442a6ebedd0bd1 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -4738,7 +4738,6 @@ "kibana-react.kibanaCodeEditor.ariaLabel": "Éditeur de code", "kibana-react.kibanaCodeEditor.enterKeyLabel": "Entrée", "kibana-react.kibanaCodeEditor.escapeKeyLabel": "Échap", - "reactPackages.mountPointPortal.errorMessage": "Erreur lors du rendu du contenu du portail.", "kibana-react.noDataPage.cantDecide.link": "Consultez la documentation pour en savoir plus.", "kibana-react.noDataPage.elasticAgentCard.description": "Utilisez Elastic Agent pour collecter de manière simple et unifiée les données de vos machines.", "kibana-react.noDataPage.elasticAgentCard.noPermission.description": "Cette intégration n'est pas encore activée. Votre administrateur possède les autorisations requises pour l'activer.", @@ -4752,6 +4751,7 @@ "kibana-react.pageFooter.makeDefaultRouteLink": "Choisir comme page de destination", "kibana-react.solutionNav.collapsibleLabel": "Réduire la navigation latérale", "kibana-react.solutionNav.openLabel": "Ouvrir la navigation latérale", + "reactPackages.mountPointPortal.errorMessage": "Erreur lors du rendu du contenu du portail.", "languageDocumentationPopover.header": "Référence de {language}", "languageDocumentationPopover.tooltip": "Référence de {lang}", "languageDocumentationPopover.searchPlaceholder": "Recherche", @@ -36834,12 +36834,6 @@ "xpack.stackConnectors.xmatters.title": "xMatters", "xpack.stackConnectors.xmatters.unexpectedNullResponseErrorMessage": "réponse nulle inattendue de xmatters", "xpack.synthetics.alertRules.monitorStatus.reasonMessage": "Le moniteur \"{name}\" de {location} est {status}. Vérifié à {checkedAt}.", - "xpack.synthetics.alerts.durationAnomaly.defaultActionMessage": "Temps de réponse anormal (niveau {severity}) détecté sur le {monitor} avec l'URL {monitorUrl} à {anomalyStartTimestamp}. La note de sévérité d'anomalie est {severityScore}.\nDes temps de réponse aussi élevés que {slowestAnomalyResponse} ont été détectés à partir de l'emplacement {observerLocation}. Le temps de réponse attendu est {expectedResponseTime}.", - "xpack.synthetics.alerts.durationAnomaly.defaultRecoveryMessage": "L'alerte pour temps de réponse anormal (niveau {severity}) détecté sur le moniteur {monitor} possédant l'URL {monitorUrl} depuis l'emplacement {observerLocation} à {anomalyStartTimestamp} a été résolue", - "xpack.synthetics.alerts.monitorStatus.defaultActionMessage": "Moniteur {monitorName} avec l'URL {monitorUrl} depuis {observerLocation} {statusMessage} Le dernier message d'erreur est {latestErrorMessage}, vérifié à {checkedAt}", - "xpack.synthetics.alerts.monitorStatus.defaultRecoveryMessage": "L'alerte pour le moniteur {monitorName} avec l'URL {monitorUrl} depuis {observerLocation} a été résolue", - "xpack.synthetics.alerts.monitorStatus.defaultRecoverySubjectMessage": "Le moniteur {monitorName} avec l'URL {monitorUrl} a récupéré", - "xpack.synthetics.alerts.monitorStatus.defaultSubjectMessage": "Le moniteur {monitorName} avec l'URL {monitorUrl} est arrêté", "xpack.synthetics.alerts.monitorStatus.upCheck.reasonWithoutDuration": "le moniteur est de nouveau opérationnel. Il a été exécuté avec succès à {checkedAt}", "xpack.synthetics.alerts.syntheticsMonitorStatus.defaultActionMessage": "\"{monitorName}\" est {status} de {locationName}. - Elastic Synthetics\n\nDétails :\n\n- Nom du moniteur : {monitorName} \n- {monitorUrlLabel} : {monitorUrl} \n- Type du moniteur : {monitorType} \n- Vérifié à : {checkedAt} \n- De : {locationName} \n- Erreur reçue : {lastErrorMessage} \n{linkMessage}", "xpack.synthetics.alerts.syntheticsMonitorStatus.defaultRecoveryMessage": "L’alerte pour \"{monitorName}\" de {locationName} n’est plus active : {recoveryReason}. - Elastic Synthetics\n\nDétails :\n\n- Nom du moniteur : {monitorName} \n- {monitorUrlLabel} : {monitorUrl} \n- Type du moniteur : {monitorType} \n- De : {locationName} \n- Dernière erreur reçue : {lastErrorMessage} \n{linkMessage}", @@ -36847,9 +36841,6 @@ "xpack.synthetics.alerts.syntheticsMonitorStatus.defaultSubjectMessage": "\"{monitorName}\" ({locationName}) est arrêté - Elastic Synthetics", "xpack.synthetics.alerts.syntheticsMonitorTLS.defaultRecoverySubjectMessage": "L’alerte a été résolue pour le certificat {commonName} - Elastic Synthetics", "xpack.synthetics.alerts.syntheticsMonitorTLS.defaultSubjectMessage": "L’alerte a été déclenchée pour le certificat {commonName} - Elastic Synthetics", - "xpack.synthetics.alerts.tls.defaultActionMessage": "Le certificat TLS {commonName} détecté de l'émetteur {issuer} est {status}. Certificat {summary}", - "xpack.synthetics.alerts.tls.defaultRecoveryMessage": "L'alerte pour le certificat TLS {commonName} de l'émetteur {issuer} a été résolue", - "xpack.synthetics.alerts.tls.legacy.defaultActionMessage": "Détection de {count} certificats TLS sur le point d'expirer ou devenant trop anciens.\n{expiringConditionalOpen}\nNombre de certificats sur le point d'expirer : {expiringCount}\nCertificats sur le point d'expirer : {expiringCommonNameAndDate}\n{expiringConditionalClose}\n{agingConditionalOpen}\nNombre de certificats vieillissants : {agingCount}\nCertificats vieillissants : {agingCommonNameAndDate}\n{agingConditionalClose}\n", "xpack.synthetics.certificates.heading": "Certificats TLS ({total})", "xpack.synthetics.certificatesRoute.title": "Certificats | {baseTitle}", "xpack.synthetics.certs.status.ok.label": " pour {okRelativeDate}", @@ -37015,14 +37006,10 @@ "xpack.synthetics.alertRules.monitorStatus.browser.label": "navigateur", "xpack.synthetics.alertRules.monitorStatus.host.label": "Hôte", "xpack.synthetics.alertRules.monitorStatus.unavailableUrlLabel": "(indisponible)", - "xpack.synthetics.alerts.durationAnomaly.clientName": "Anomalie de durée Uptime", - "xpack.synthetics.alerts.durationAnomaly.description": "Alerte lorsque la durée du moniteur Uptime est anormale.", "xpack.synthetics.alerts.monitorStatus.absoluteLink.label": "- Lien", - "xpack.synthetics.alerts.monitorStatus.clientName": "Statut du moniteur Uptime", "xpack.synthetics.alerts.monitorStatus.defaultRecovery.status": "a récupéré", "xpack.synthetics.alerts.monitorStatus.deleteMonitor.reason": "le moniteur a été supprimé", "xpack.synthetics.alerts.monitorStatus.deleteMonitor.status": "a été supprimé", - "xpack.synthetics.alerts.monitorStatus.description": "Alerte lorsqu'un monitoring est arrêté ou qu'un seuil de disponibilité est dépassé.", "xpack.synthetics.alerts.monitorStatus.downLabel": "bas", "xpack.synthetics.alerts.monitorStatus.relativeLink.label": "- Lien relatif", "xpack.synthetics.alerts.monitorStatus.removedLocation.reason": "cet emplacement a été retiré du moniteur", @@ -37032,11 +37019,7 @@ "xpack.synthetics.alerts.settings.addConnector": "Ajouter un connecteur", "xpack.synthetics.alerts.syntheticsMonitorStatus.clientName": "Statut du moniteur", "xpack.synthetics.alerts.syntheticsMonitorStatus.description": "Alerte lorsqu'un moniteur est arrêté.", - "xpack.synthetics.alerts.tls.clientName": "Uptime TLS", "xpack.synthetics.alerts.tls.criteriaExpression.description": "quand", - "xpack.synthetics.alerts.tls.description": "Alerte lorsque le certificat TLS d'un moniteur Uptime est sur le point d'expirer.", - "xpack.synthetics.alerts.tls.legacy.clientName": "Uptime TLS (existant)", - "xpack.synthetics.alerts.tls.legacy.description": "Alerte lorsque le certificat TLS d'un moniteur Uptime est sur le point d'expirer. Cette alerte sera déclassée dans une future version.", "xpack.synthetics.alerts.toggleAlertFlyoutButtonText": "Alertes et règles", "xpack.synthetics.alertsRulesPopover.toggleButton.ariaLabel": "Ouvrir les alertes et le menu des règles", "xpack.synthetics.analyzeDataButtonLabel": "Explorer les données", @@ -37782,8 +37765,6 @@ "xpack.synthetics.settings.enablement.fail": "Échec de l’activation de l’application Synthetics", "xpack.synthetics.settings.error.couldNotSave": "Impossible d'enregistrer les paramètres !", "xpack.synthetics.settings.getParams.failed": "Impossible d’obtenir les paramètres globaux.", - "xpack.synthetics.settings.invalid.error": "La valeur doit être supérieure à 0.", - "xpack.synthetics.settings.invalid.nanError": "La valeur doit être un entier.", "xpack.synthetics.settings.noSpace.error": "Les noms d'index ne doivent pas contenir d'espace", "xpack.synthetics.settings.saveSuccess": "Paramètres enregistrés !", "xpack.synthetics.settings.syncGlobalParams": "Paramètres globaux appliqués correctement à tous les moniteurs", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 8eabc63eb8ea96..ed681f32a13a3e 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -4754,7 +4754,6 @@ "kibana-react.kibanaCodeEditor.ariaLabel": "コードエディター", "kibana-react.kibanaCodeEditor.enterKeyLabel": "Enter", "kibana-react.kibanaCodeEditor.escapeKeyLabel": "Esc", - "reactPackages.mountPointPortal.errorMessage": "ポータルコンテンツのレンダリングエラー", "kibana-react.noDataPage.cantDecide.link": "詳細については、ドキュメントをご確認ください。", "kibana-react.noDataPage.elasticAgentCard.description": "Elasticエージェントを使用すると、シンプルで統一された方法でコンピューターからデータを収集するできます。", "kibana-react.noDataPage.elasticAgentCard.noPermission.description": "この統合はまだ有効ではありません。管理者にはオンにするために必要なアクセス権があります。", @@ -4768,6 +4767,7 @@ "kibana-react.pageFooter.makeDefaultRouteLink": "これをランディングページにする", "kibana-react.solutionNav.collapsibleLabel": "サイドナビゲーションを折りたたむ", "kibana-react.solutionNav.openLabel": "サイドナビゲーションを開く", + "reactPackages.mountPointPortal.errorMessage": "ポータルコンテンツのレンダリングエラー", "languageDocumentationPopover.header": "{language}リファレンス", "languageDocumentationPopover.tooltip": "{lang}リファレンス", "languageDocumentationPopover.searchPlaceholder": "検索", @@ -36833,12 +36833,6 @@ "xpack.stackConnectors.xmatters.title": "xMatters", "xpack.stackConnectors.xmatters.unexpectedNullResponseErrorMessage": "xmattersからの予期しないnull応答", "xpack.synthetics.alertRules.monitorStatus.reasonMessage": "{location}からのモニター\"{name}\"は{status}です。確認:{checkedAt}。", - "xpack.synthetics.alerts.durationAnomaly.defaultActionMessage": "{monitor}で{anomalyStartTimestamp}で{monitorUrl}のurlで異常な({severity}レベル)応答時間を検出しました。異常重要度スコアは{severityScore}です。\n{observerLocation}の位置から{slowestAnomalyResponse}の高い応答時間が検出されています。想定応答時間は{expectedResponseTime}です。", - "xpack.synthetics.alerts.durationAnomaly.defaultRecoveryMessage": "{anomalyStartTimestamp}の{observerLocation}地点から{monitorUrl}のモニター{monitor}で検出された応答時間異常({severity}レベル)のアラートが回復しました", - "xpack.synthetics.alerts.monitorStatus.defaultActionMessage": "{monitorName} を {observerLocation} から {monitorUrl} のurlで監視する {statusMessage} 最新のエラーメッセージは {latestErrorMessage} で、{checkedAt} で確認", - "xpack.synthetics.alerts.monitorStatus.defaultRecoveryMessage": "{observerLocation}から{monitorUrl}のurlを持つモニター{monitorName}に対するアラートが回復しました", - "xpack.synthetics.alerts.monitorStatus.defaultRecoverySubjectMessage": "URL {monitorUrl}のモニター\"{monitorName}\"が回復しました", - "xpack.synthetics.alerts.monitorStatus.defaultSubjectMessage": "url {monitorUrl}のモニタ{monitorName}がダウンしています", "xpack.synthetics.alerts.monitorStatus.upCheck.reasonWithoutDuration": "モニターが再起動しました。{checkedAt}に正常に実行されました。", "xpack.synthetics.alerts.syntheticsMonitorStatus.defaultActionMessage": "\"{monitorName}\"は{locationName}からの{status}です。- Elastic Synthetics\n\n詳細:\n\n- モニター名:{monitorName} \n- {monitorUrlLabel}: {monitorUrl} \n- モニタータイプ:{monitorType} \n- 確認日時:{checkedAt} \n- 場所:{locationName} \n- 受信したエラー:{lastErrorMessage} \n{linkMessage}", "xpack.synthetics.alerts.syntheticsMonitorStatus.defaultRecoveryMessage": "{locationName}からの\"{monitorName}\"のアラートはアクティブではありません:{recoveryReason}。- Elastic Synthetics\n\n詳細:\n\n- モニター名:{monitorName} \n- {monitorUrlLabel}: {monitorUrl} \n- モニタータイプ:{monitorType} \n- 場所:{locationName} \n- 最後に受信したエラー:{lastErrorMessage} \n{linkMessage}", @@ -36846,9 +36840,6 @@ "xpack.synthetics.alerts.syntheticsMonitorStatus.defaultSubjectMessage": "\"{monitorName}\"({locationName})は停止しています - Elastic Synthetics", "xpack.synthetics.alerts.syntheticsMonitorTLS.defaultRecoverySubjectMessage": "証明書{commonName}のアラートが解決しました - Elastic Synthetics", "xpack.synthetics.alerts.syntheticsMonitorTLS.defaultSubjectMessage": "証明書{commonName}のアラートがトリガーされました - Elastic Synthetics", - "xpack.synthetics.alerts.tls.defaultActionMessage": "発行者{issuer}のTLS証明書{commonName}が{status}であることを検出しました。証明書{summary}", - "xpack.synthetics.alerts.tls.defaultRecoveryMessage": "発行者{issuer}のTLS証明書{commonName}のアラートが回復しました", - "xpack.synthetics.alerts.tls.legacy.defaultActionMessage": "期限切れになるか古くなりすぎた{count}個のTLS証明書証明書を検知しました。\n{expiringConditionalOpen}\n有効期限切れになる証明書件数:{expiringCount}\n有効期限切れになる証明書:{expiringCommonNameAndDate}\n{expiringConditionalClose}\n{agingConditionalOpen}\n古い証明書件数:{agingCount}\n古い証明書:{agingCommonNameAndDate}\n{agingConditionalClose}\n", "xpack.synthetics.certificates.heading": "TLS証明書({total})", "xpack.synthetics.certificatesRoute.title": "証明書 | {baseTitle}", "xpack.synthetics.certs.status.ok.label": " {okRelativeDate}", @@ -37014,14 +37005,10 @@ "xpack.synthetics.alertRules.monitorStatus.browser.label": "ブラウザー", "xpack.synthetics.alertRules.monitorStatus.host.label": "ホスト", "xpack.synthetics.alertRules.monitorStatus.unavailableUrlLabel": "(使用不可)", - "xpack.synthetics.alerts.durationAnomaly.clientName": "アップタイム期間異常", - "xpack.synthetics.alerts.durationAnomaly.description": "アップタイム監視期間が異常なときにアラートを発行します。", "xpack.synthetics.alerts.monitorStatus.absoluteLink.label": "- リンク", - "xpack.synthetics.alerts.monitorStatus.clientName": "稼働状況の監視ステータス", "xpack.synthetics.alerts.monitorStatus.defaultRecovery.status": "回復しました", "xpack.synthetics.alerts.monitorStatus.deleteMonitor.reason": "モニターが削除されました", "xpack.synthetics.alerts.monitorStatus.deleteMonitor.status": "が削除されました", - "xpack.synthetics.alerts.monitorStatus.description": "監視が停止しているか、可用性しきい値に違反したときにアラートを発行します。", "xpack.synthetics.alerts.monitorStatus.downLabel": "ダウン", "xpack.synthetics.alerts.monitorStatus.relativeLink.label": "- 相対リンク", "xpack.synthetics.alerts.monitorStatus.removedLocation.reason": "この場所はモニターから削除されました", @@ -37031,11 +37018,7 @@ "xpack.synthetics.alerts.settings.addConnector": "コネクターの追加", "xpack.synthetics.alerts.syntheticsMonitorStatus.clientName": "監視ステータス", "xpack.synthetics.alerts.syntheticsMonitorStatus.description": "モニターがダウンしているときにアラートを通知します。", - "xpack.synthetics.alerts.tls.clientName": "アップタイムTLS", "xpack.synthetics.alerts.tls.criteriaExpression.description": "タイミング", - "xpack.synthetics.alerts.tls.description": "アップタイム監視の TLS 証明書の有効期限が近いときにアラートを発行します。", - "xpack.synthetics.alerts.tls.legacy.clientName": "アップタイムTLS(レガシー)", - "xpack.synthetics.alerts.tls.legacy.description": "アップタイム監視の TLS 証明書の有効期限が近いときにアラートを発行します。このアラートは将来のバージョンで廃止予定です。", "xpack.synthetics.alerts.toggleAlertFlyoutButtonText": "アラートとルール", "xpack.synthetics.alertsRulesPopover.toggleButton.ariaLabel": "アラートおよびルールメニューを開く", "xpack.synthetics.analyzeDataButtonLabel": "データの探索", @@ -37781,8 +37764,6 @@ "xpack.synthetics.settings.enablement.fail": "Syntheticsアプリを有効化できませんでした", "xpack.synthetics.settings.error.couldNotSave": "設定を保存できませんでした!", "xpack.synthetics.settings.getParams.failed": "グローバルパラメーターを取得できませんでした。", - "xpack.synthetics.settings.invalid.error": "値は0よりも大きい値でなければなりません。", - "xpack.synthetics.settings.invalid.nanError": "値は整数でなければなりません。", "xpack.synthetics.settings.noSpace.error": "インデックス名にはスペースを使用できません", "xpack.synthetics.settings.saveSuccess": "設定が保存されました。", "xpack.synthetics.settings.syncGlobalParams": "グローバルパラメーターをすべてのモニターに正常に適用しました", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 61295a1cc366be..918538b3edfad8 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -4753,7 +4753,6 @@ "kibana-react.kibanaCodeEditor.ariaLabel": "代码编辑器", "kibana-react.kibanaCodeEditor.enterKeyLabel": "Enter", "kibana-react.kibanaCodeEditor.escapeKeyLabel": "Esc", - "reactPackages.mountPointPortal.errorMessage": "呈现门户内容时出错", "kibana-react.noDataPage.cantDecide.link": "请参阅我们的文档以了解更多信息。", "kibana-react.noDataPage.elasticAgentCard.description": "使用 Elastic 代理以简单统一的方式从您的计算机中收集数据。", "kibana-react.noDataPage.elasticAgentCard.noPermission.description": "尚未启用此集成。您的管理员具有打开它所需的权限。", @@ -4767,6 +4766,7 @@ "kibana-react.pageFooter.makeDefaultRouteLink": "将此设为我的登陆页面", "kibana-react.solutionNav.collapsibleLabel": "折叠侧边导航", "kibana-react.solutionNav.openLabel": "打开侧边导航", + "reactPackages.mountPointPortal.errorMessage": "呈现门户内容时出错", "languageDocumentationPopover.header": "{language} 参考", "languageDocumentationPopover.tooltip": "{lang} 参考", "languageDocumentationPopover.searchPlaceholder": "搜索", @@ -36827,12 +36827,6 @@ "xpack.stackConnectors.xmatters.title": "xMatters", "xpack.stackConnectors.xmatters.unexpectedNullResponseErrorMessage": "来自 xmatters 的异常空响应", "xpack.synthetics.alertRules.monitorStatus.reasonMessage": "来自 {location} 的监测“{name}”为 {status}。已于 {checkedAt} 检查。", - "xpack.synthetics.alerts.durationAnomaly.defaultActionMessage": "{anomalyStartTimestamp} 在 url {monitorUrl} 的 {monitor} 上检测到异常({severity} 级别)响应时间。异常严重性分数为 {severityScore}。\n从位置 {observerLocation} 检测到高达 {slowestAnomalyResponse} 的响应时间。预期响应时间为 {expectedResponseTime}。", - "xpack.synthetics.alerts.durationAnomaly.defaultRecoveryMessage": "{anomalyStartTimestamp} 从位置 {observerLocation} 在 url {monitorUrl} 的监测 {monitor} 上检测到异常({severity} 级别)响应时间的告警已恢复", - "xpack.synthetics.alerts.monitorStatus.defaultActionMessage": "在 {observerLocation},URL 为 {monitorUrl} 的监测 {monitorName} 是 {statusMessage} 最新错误消息是 {latestErrorMessage},已于 {checkedAt} 检查", - "xpack.synthetics.alerts.monitorStatus.defaultRecoveryMessage": "来自 {observerLocation} 且 url 为 {monitorUrl} 的监测 {monitorName} 的告警已恢复", - "xpack.synthetics.alerts.monitorStatus.defaultRecoverySubjectMessage": "URL 为 {monitorUrl} 的监测 {monitorName} 已恢复", - "xpack.synthetics.alerts.monitorStatus.defaultSubjectMessage": "URL 为 {monitorUrl} 的监测 {monitorName} 已关闭", "xpack.synthetics.alerts.monitorStatus.upCheck.reasonWithoutDuration": "监测现已再次启动。它于 {checkedAt}成功运行", "xpack.synthetics.alerts.syntheticsMonitorStatus.defaultActionMessage": "“{monitorName}”为来自 {locationName} 的 {status} 状态 - Elastic Synthetics\n\n详情:\n\n- 监测名称:{monitorName} \n- {monitorUrlLabel}:{monitorUrl} \n- 监测类型:{monitorType} \n- 检查时间:{checkedAt} \n- 来自:{locationName} \n- 收到错误:{lastErrorMessage} \n{linkMessage}", "xpack.synthetics.alerts.syntheticsMonitorStatus.defaultRecoveryMessage": "来自 {locationName} 的“{monitorName}”的告警不再处于活动状态:{recoveryReason} - Elastic Synthetics\n\n详情:\n\n- 监测名称:{monitorName} \n- {monitorUrlLabel}:{monitorUrl} \n- 监测类型:{monitorType} \n- 来自:{locationName} \n- 收到的上一个错误:{lastErrorMessage} \n{linkMessage}", @@ -36840,9 +36834,6 @@ "xpack.synthetics.alerts.syntheticsMonitorStatus.defaultSubjectMessage": "“{monitorName}”({locationName}) 已关闭 - Elastic Synthetics", "xpack.synthetics.alerts.syntheticsMonitorTLS.defaultRecoverySubjectMessage": "告警已解析证书 {commonName} - Elastic Synthetics", "xpack.synthetics.alerts.syntheticsMonitorTLS.defaultSubjectMessage": "已针对证书 {commonName} 触发告警 - Elastic Synthetics", - "xpack.synthetics.alerts.tls.defaultActionMessage": "检测到来自颁发者 {issuer} 的 TLS 证书 {commonName} 的状态为 {status}。证书 {summary}", - "xpack.synthetics.alerts.tls.defaultRecoveryMessage": "来自颁发者 {issuer} 的 TLS 证书 {commonName} 的告警已恢复", - "xpack.synthetics.alerts.tls.legacy.defaultActionMessage": "检测到 {count} 个 TLS 证书即将过期或即将过时。\n{expiringConditionalOpen}\n即将过期的证书计数:{expiringCount}\n即将过期的证书:{expiringCommonNameAndDate}\n{expiringConditionalClose}\n{agingConditionalOpen}\n过时的证书计数:{agingCount}\n过时的证书:{agingCommonNameAndDate}\n{agingConditionalClose}\n", "xpack.synthetics.certificates.heading": "TLS 证书 ({total})", "xpack.synthetics.certificatesRoute.title": "证书 | {baseTitle}", "xpack.synthetics.certs.status.ok.label": " 对于 {okRelativeDate}", @@ -37008,14 +36999,10 @@ "xpack.synthetics.alertRules.monitorStatus.browser.label": "浏览器", "xpack.synthetics.alertRules.monitorStatus.host.label": "主机", "xpack.synthetics.alertRules.monitorStatus.unavailableUrlLabel": "(不可用)", - "xpack.synthetics.alerts.durationAnomaly.clientName": "Uptime 持续时间异常", - "xpack.synthetics.alerts.durationAnomaly.description": "运行时间监测持续时间异常时告警。", "xpack.synthetics.alerts.monitorStatus.absoluteLink.label": "- 链接", - "xpack.synthetics.alerts.monitorStatus.clientName": "运行时间监测状态", "xpack.synthetics.alerts.monitorStatus.defaultRecovery.status": "已恢复", "xpack.synthetics.alerts.monitorStatus.deleteMonitor.reason": "此监测已删除", "xpack.synthetics.alerts.monitorStatus.deleteMonitor.status": "已删除", - "xpack.synthetics.alerts.monitorStatus.description": "监测关闭或超出可用性阈值时告警。", "xpack.synthetics.alerts.monitorStatus.downLabel": "关闭", "xpack.synthetics.alerts.monitorStatus.relativeLink.label": "- 相对链接", "xpack.synthetics.alerts.monitorStatus.removedLocation.reason": "此位置已从监测中移除", @@ -37025,11 +37012,7 @@ "xpack.synthetics.alerts.settings.addConnector": "添加连接器", "xpack.synthetics.alerts.syntheticsMonitorStatus.clientName": "监测状态", "xpack.synthetics.alerts.syntheticsMonitorStatus.description": "监测关闭时告警。", - "xpack.synthetics.alerts.tls.clientName": "Uptime TLS", "xpack.synthetics.alerts.tls.criteriaExpression.description": "当", - "xpack.synthetics.alerts.tls.description": "运行时间监测的 TLS 证书即将过期时告警。", - "xpack.synthetics.alerts.tls.legacy.clientName": "Uptime TLS(旧版)", - "xpack.synthetics.alerts.tls.legacy.description": "运行时间监测的 TLS 证书即将过期时告警。未来的版本将弃用此告警。", "xpack.synthetics.alerts.toggleAlertFlyoutButtonText": "告警和规则", "xpack.synthetics.alertsRulesPopover.toggleButton.ariaLabel": "打开告警和规则菜单", "xpack.synthetics.analyzeDataButtonLabel": "浏览数据", @@ -37775,8 +37758,6 @@ "xpack.synthetics.settings.enablement.fail": "无法启用 Synthetics 应用", "xpack.synthetics.settings.error.couldNotSave": "无法保存设置!", "xpack.synthetics.settings.getParams.failed": "无法获取全局参数。", - "xpack.synthetics.settings.invalid.error": "值必须大于 0。", - "xpack.synthetics.settings.invalid.nanError": "值必须为整数。", "xpack.synthetics.settings.noSpace.error": "索引名称不得包含空格", "xpack.synthetics.settings.saveSuccess": "设置已保存!", "xpack.synthetics.settings.syncGlobalParams": "已成功将全局参数应用到所有监测", diff --git a/x-pack/plugins/synthetics/common/types/integration_deprecation.ts b/x-pack/plugins/uptime/common/index.ts similarity index 72% rename from x-pack/plugins/synthetics/common/types/integration_deprecation.ts rename to x-pack/plugins/uptime/common/index.ts index 951de85c046b65..50725f0c3a90af 100644 --- a/x-pack/plugins/synthetics/common/types/integration_deprecation.ts +++ b/x-pack/plugins/uptime/common/index.ts @@ -5,6 +5,4 @@ * 2.0. */ -export interface SyntheticsHasIntegrationMonitorsResponse { - hasIntegrationMonitors: boolean; -} +export { UPTIME_RULE_TYPES } from './constants/uptime_alerts'; diff --git a/x-pack/test/alerting_api_integration/observability/synthetics_rule.ts b/x-pack/test/alerting_api_integration/observability/synthetics_rule.ts index 21192aa2075f9e..888d2a0d7f8975 100644 --- a/x-pack/test/alerting_api_integration/observability/synthetics_rule.ts +++ b/x-pack/test/alerting_api_integration/observability/synthetics_rule.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import { API_URLS, SYNTHETICS_API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { SYNTHETICS_API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { SanitizedRule } from '@kbn/alerting-plugin/common'; import { omit } from 'lodash'; import { TlsTranslations } from '@kbn/synthetics-plugin/common/rules/synthetics/translations'; @@ -36,7 +36,7 @@ export default function ({ getService }: FtrProviderContext) { it('creates rule when settings are configured', async () => { await supertest - .post(API_URLS.DYNAMIC_SETTINGS) + .post(SYNTHETICS_API_URLS.DYNAMIC_SETTINGS) .set('kbn-xsrf', 'true') .send({ heartbeatIndices: 'heartbeat-8*,heartbeat-7*', @@ -76,7 +76,7 @@ export default function ({ getService }: FtrProviderContext) { it('updates rules when settings are updated', async () => { await supertest - .post(API_URLS.DYNAMIC_SETTINGS) + .post(SYNTHETICS_API_URLS.DYNAMIC_SETTINGS) .set('kbn-xsrf', 'true') .send({ heartbeatIndices: 'heartbeat-8*,heartbeat-7*', diff --git a/x-pack/test/api_integration/apis/uptime/feature_controls.ts b/x-pack/test/api_integration/apis/uptime/feature_controls.ts index 39d74066363534..c9c545cbad2423 100644 --- a/x-pack/test/api_integration/apis/uptime/feature_controls.ts +++ b/x-pack/test/api_integration/apis/uptime/feature_controls.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { API_URLS } from '@kbn/uptime-plugin/common/constants'; import { FtrProviderContext } from '../../ftr_provider_context'; import { PINGS_DATE_RANGE_END, PINGS_DATE_RANGE_START } from './constants'; diff --git a/x-pack/test/api_integration/apis/uptime/get_all_pings.ts b/x-pack/test/api_integration/apis/uptime/get_all_pings.ts index 19b78854a8df3d..a7547d61992f23 100644 --- a/x-pack/test/api_integration/apis/uptime/get_all_pings.ts +++ b/x-pack/test/api_integration/apis/uptime/get_all_pings.ts @@ -7,7 +7,7 @@ import moment from 'moment'; import expect from '@kbn/expect'; -import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { API_URLS } from '@kbn/uptime-plugin/common/constants'; import { PINGS_DATE_RANGE_START, PINGS_DATE_RANGE_END } from './constants'; import { FtrProviderContext } from '../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts b/x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts index 44ab0f694ba5d6..8ecdbc9b615da1 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts @@ -7,8 +7,8 @@ import expect from '@kbn/expect'; import { isRight } from 'fp-ts/lib/Either'; -import { DynamicSettingsCodec, DynamicSettings } from '@kbn/synthetics-plugin/common/runtime_types'; -import { DYNAMIC_SETTINGS_DEFAULTS, API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { DynamicSettingsCodec, DynamicSettings } from '@kbn/uptime-plugin/common/runtime_types'; +import { DYNAMIC_SETTINGS_DEFAULTS, API_URLS } from '@kbn/uptime-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test/api_integration/apis/uptime/rest/index_status.ts b/x-pack/test/api_integration/apis/uptime/rest/index_status.ts index d29d66d436bc97..50ff47f04be5dd 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/index_status.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/index_status.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { API_URLS } from '@kbn/uptime-plugin/common/constants'; import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_duration.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_duration.ts index c5915d06564df7..3a0d066789be7a 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_duration.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_duration.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { API_URLS } from '@kbn/uptime-plugin/common/constants'; import expect from '@kbn/expect'; import { expectFixtureEql } from './helper/expect_fixture_eql'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_latest_status.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_latest_status.ts index e5cf59be672336..9e4632f552a905 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_latest_status.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_latest_status.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { API_URLS } from '@kbn/uptime-plugin/common/constants'; import { expectFixtureEql } from './helper/expect_fixture_eql'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_generated.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_generated.ts index 5bbe7f7312102e..0ae73258d7acbf 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_generated.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_generated.ts @@ -7,7 +7,7 @@ import expect from '@kbn/expect'; import { MonitorSummary } from '@kbn/synthetics-plugin/common/runtime_types'; -import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { API_URLS } from '@kbn/uptime-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { makeChecksWithStatus } from './helper/make_checks'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts index 438211665674a0..1f0e04a74db71e 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts @@ -11,7 +11,7 @@ import { MonitorSummariesResult, MonitorSummariesResultType, } from '@kbn/synthetics-plugin/common/runtime_types'; -import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { API_URLS } from '@kbn/uptime-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; interface ExpectedMonitorStatesPage { diff --git a/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts b/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts index a46eff97826a87..6246a2d049583d 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { API_URLS } from '@kbn/uptime-plugin/common/constants'; import { expectFixtureEql } from './helper/expect_fixture_eql'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts index 5c179a15b75251..84d4af6f650be6 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts @@ -8,8 +8,8 @@ import expect from '@kbn/expect'; import { isLeft } from 'fp-ts/lib/Either'; import { PathReporter } from 'io-ts/lib/PathReporter'; -import { PingsResponseType } from '@kbn/synthetics-plugin/common/runtime_types'; -import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { PingsResponseType } from '@kbn/uptime-plugin/common/runtime_types'; +import { API_URLS } from '@kbn/uptime-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; function decodePingsResponseData(response: any) { diff --git a/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts b/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts index 3fa3d458321d37..492dce4841511e 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { API_URLS } from '@kbn/uptime-plugin/common/constants'; import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { makeChecksWithStatus, getChecksDateRange } from './helper/make_checks'; diff --git a/x-pack/test/functional_with_es_ssl/apps/discover_ml_uptime/uptime/simple_down_alert.ts b/x-pack/test/functional_with_es_ssl/apps/discover_ml_uptime/uptime/simple_down_alert.ts index 81a0a9b438af76..98a4a09ee2b8ad 100644 --- a/x-pack/test/functional_with_es_ssl/apps/discover_ml_uptime/uptime/simple_down_alert.ts +++ b/x-pack/test/functional_with_es_ssl/apps/discover_ml_uptime/uptime/simple_down_alert.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import { MonitorStatusTranslations } from '@kbn/synthetics-plugin/common/rules/legacy_uptime/translations'; +import { MonitorStatusTranslations } from '@kbn/uptime-plugin/common/rules/legacy_uptime/translations'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { deleteUptimeSettingsObject } from '../../../../functional/apps/uptime';