From 65796d2320286c3f45f30c5ed96c735fb27aa66c Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 10 Aug 2021 15:41:32 -0400 Subject: [PATCH] [APM] Default env for creating rule outside of APM app (#107942) (#108042) Co-authored-by: Dario Gieselaar --- .../alerting/error_count_alert_trigger/index.tsx | 2 ++ x-pack/plugins/apm/public/components/alerting/fields.tsx | 7 +++++-- .../alerting/transaction_duration_alert_trigger/index.tsx | 3 +++ .../transaction_duration_anomaly_alert_trigger/index.tsx | 2 ++ .../transaction_error_rate_alert_trigger/index.tsx | 2 ++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/apm/public/components/alerting/error_count_alert_trigger/index.tsx b/x-pack/plugins/apm/public/components/alerting/error_count_alert_trigger/index.tsx index 3c79a2475bf29..a06520f1c5bfc 100644 --- a/x-pack/plugins/apm/public/components/alerting/error_count_alert_trigger/index.tsx +++ b/x-pack/plugins/apm/public/components/alerting/error_count_alert_trigger/index.tsx @@ -8,6 +8,7 @@ import { i18n } from '@kbn/i18n'; import { defaults, omit } from 'lodash'; import React from 'react'; +import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; import { ForLastExpression } from '../../../../../triggers_actions_ui/public'; import { asInteger } from '../../../../common/utils/formatters'; import { useEnvironmentsFetcher } from '../../../hooks/use_environments_fetcher'; @@ -47,6 +48,7 @@ export function ErrorCountAlertTrigger(props: Props) { threshold: 25, windowSize: 1, windowUnit: 'm', + environment: ENVIRONMENT_ALL.value, } ); diff --git a/x-pack/plugins/apm/public/components/alerting/fields.tsx b/x-pack/plugins/apm/public/components/alerting/fields.tsx index 2e16599c02716..8480fd276cb74 100644 --- a/x-pack/plugins/apm/public/components/alerting/fields.tsx +++ b/x-pack/plugins/apm/public/components/alerting/fields.tsx @@ -9,7 +9,10 @@ import { EuiSelect, EuiExpression, EuiFieldNumber } from '@elastic/eui'; import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiSelectOption } from '@elastic/eui'; -import { getEnvironmentLabel } from '../../../common/environment_filter_values'; +import { + ENVIRONMENT_ALL, + getEnvironmentLabel, +} from '../../../common/environment_filter_values'; import { PopoverExpression } from './service_alert_trigger/popover_expression'; const ALL_OPTION = i18n.translate('xpack.apm.alerting.fields.all_option', { @@ -42,7 +45,7 @@ export function EnvironmentField({ // "1" means "All" is the only option and we should not show a select. if (options.length === 1) { - return ; + return ; } return ( diff --git a/x-pack/plugins/apm/public/components/alerting/transaction_duration_alert_trigger/index.tsx b/x-pack/plugins/apm/public/components/alerting/transaction_duration_alert_trigger/index.tsx index c54f32d805818..2a73cba0a63d5 100644 --- a/x-pack/plugins/apm/public/components/alerting/transaction_duration_alert_trigger/index.tsx +++ b/x-pack/plugins/apm/public/components/alerting/transaction_duration_alert_trigger/index.tsx @@ -9,6 +9,7 @@ import { EuiSelect } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { defaults, map, omit } from 'lodash'; import React from 'react'; +import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; import { CoreStart } from '../../../../../../../src/core/public'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { ForLastExpression } from '../../../../../triggers_actions_ui/public'; @@ -90,6 +91,8 @@ export function TransactionDurationAlertTrigger(props: Props) { threshold: 1500, windowSize: 5, windowUnit: 'm', + environment: ENVIRONMENT_ALL.value, + transactionType: transactionTypes[0], } ); diff --git a/x-pack/plugins/apm/public/components/alerting/transaction_duration_anomaly_alert_trigger/index.tsx b/x-pack/plugins/apm/public/components/alerting/transaction_duration_anomaly_alert_trigger/index.tsx index 97ce73a746329..519b18cd3a6b6 100644 --- a/x-pack/plugins/apm/public/components/alerting/transaction_duration_anomaly_alert_trigger/index.tsx +++ b/x-pack/plugins/apm/public/components/alerting/transaction_duration_anomaly_alert_trigger/index.tsx @@ -8,6 +8,7 @@ import { i18n } from '@kbn/i18n'; import { defaults, omit } from 'lodash'; import React from 'react'; +import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; import { ANOMALY_SEVERITY } from '../../../../common/ml_constants'; import { useServiceTransactionTypesFetcher } from '../../../context/apm_service/use_service_transaction_types_fetcher'; import { useEnvironmentsFetcher } from '../../../hooks/use_environments_fetcher'; @@ -60,6 +61,7 @@ export function TransactionDurationAnomalyAlertTrigger(props: Props) { windowSize: 15, windowUnit: 'm', anomalySeverityType: ANOMALY_SEVERITY.CRITICAL, + environment: ENVIRONMENT_ALL.value, } ); diff --git a/x-pack/plugins/apm/public/components/alerting/transaction_error_rate_alert_trigger/index.tsx b/x-pack/plugins/apm/public/components/alerting/transaction_error_rate_alert_trigger/index.tsx index 6118f99e4bd9f..8f2e212a22681 100644 --- a/x-pack/plugins/apm/public/components/alerting/transaction_error_rate_alert_trigger/index.tsx +++ b/x-pack/plugins/apm/public/components/alerting/transaction_error_rate_alert_trigger/index.tsx @@ -7,6 +7,7 @@ import { defaults, omit } from 'lodash'; import React from 'react'; +import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; import { CoreStart } from '../../../../../../../src/core/public'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { ForLastExpression } from '../../../../../triggers_actions_ui/public'; @@ -57,6 +58,7 @@ export function TransactionErrorRateAlertTrigger(props: Props) { threshold: 30, windowSize: 5, windowUnit: 'm', + environment: ENVIRONMENT_ALL.value, } );