Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APM] Default env for creating rule outside of APM app #107942

Merged
merged 4 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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],
}
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could make it clear to users that they cannot create alerts from here:

Suggested change
);
);
if(!metadata?.serviceName) {
return <EuiCallout>Creating alerts from here is not supported. Please go to the [APM app](link))</EuiCallout>
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned in #107940

Copy link
Member

@sorenlouv sorenlouv Aug 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I saw. I was hoping we could do something for 7.15 - like adding a callout to at least let the user know that they cannot create alerts.
Implementing the free form field with suggestions is much better but likely to be a bigger task and not something we'll get around to before FF.


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