Skip to content

Commit

Permalink
[APM] Default env for creating rule outside of APM app (elastic#107942)…
Browse files Browse the repository at this point in the history
… (elastic#108042)

Co-authored-by: Dario Gieselaar <[email protected]>
  • Loading branch information
kibanamachine and dgieselaar authored Aug 10, 2021
1 parent 8402aab commit 65796d2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -47,6 +48,7 @@ export function ErrorCountAlertTrigger(props: Props) {
threshold: 25,
windowSize: 1,
windowUnit: 'm',
environment: ENVIRONMENT_ALL.value,
}
);

Expand Down
7 changes: 5 additions & 2 deletions x-pack/plugins/apm/public/components/alerting/fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down Expand Up @@ -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 <EuiExpression description={title} value={currentValue} />;
return <EuiExpression description={title} value={ENVIRONMENT_ALL.text} />;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -90,6 +91,8 @@ export function TransactionDurationAlertTrigger(props: Props) {
threshold: 1500,
windowSize: 5,
windowUnit: 'm',
environment: ENVIRONMENT_ALL.value,
transactionType: transactionTypes[0],
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -60,6 +61,7 @@ export function TransactionDurationAnomalyAlertTrigger(props: Props) {
windowSize: 15,
windowUnit: 'm',
anomalySeverityType: ANOMALY_SEVERITY.CRITICAL,
environment: ENVIRONMENT_ALL.value,
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -57,6 +58,7 @@ export function TransactionErrorRateAlertTrigger(props: Props) {
threshold: 30,
windowSize: 5,
windowUnit: 'm',
environment: ENVIRONMENT_ALL.value,
}
);

Expand Down

0 comments on commit 65796d2

Please sign in to comment.