diff --git a/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts b/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts index 6b9cc7913019a8..adfa002e8e20a6 100644 --- a/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts +++ b/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts @@ -48,9 +48,11 @@ export const CUSTOM_LABEL = i18n.translate('xpack.synthetics.connectionProfile.c defaultMessage: 'Custom', }); +export const DEFAULT_THROTTLING_VALUE = { download: '5', upload: '3', latency: '20' }; + export const PROFILE_VALUES: ThrottlingConfig[] = [ { - value: { download: '5', upload: '3', latency: '20' }, + value: DEFAULT_THROTTLING_VALUE, id: PROFILE_VALUES_ENUM.DEFAULT, label: i18n.translate('xpack.synthetics.connectionProfile.default', { defaultMessage: 'Default', diff --git a/x-pack/plugins/synthetics/common/formatters/browser/formatters.ts b/x-pack/plugins/synthetics/common/formatters/browser/formatters.ts index 0132d8340cd0b3..734c9421f33683 100644 --- a/x-pack/plugins/synthetics/common/formatters/browser/formatters.ts +++ b/x-pack/plugins/synthetics/common/formatters/browser/formatters.ts @@ -12,6 +12,7 @@ import { objectToJsonFormatter, stringToJsonFormatter, } from '../formatting_utils'; +import { DEFAULT_THROTTLING_VALUE } from '../../constants/monitor_defaults'; import { tlsFormatters } from '../tls/formatters'; @@ -21,9 +22,9 @@ export const throttlingFormatter: Formatter = (fields) => { const throttling = fields[ConfigKey.THROTTLING_CONFIG]; return JSON.stringify({ - download: Number(throttling.value.download), - upload: Number(throttling.value.upload), - latency: Number(throttling.value.latency), + download: Number(throttling?.value?.download || DEFAULT_THROTTLING_VALUE.download), + upload: Number(throttling?.value?.upload || DEFAULT_THROTTLING_VALUE.upload), + latency: Number(throttling?.value?.latency || DEFAULT_THROTTLING_VALUE), }); };