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

[Metrics UI] Disable anomaly alerting #93813

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 @@ -14,18 +14,15 @@ import {
EuiContextMenuPanelDescriptor,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { useInfraMLCapabilities } from '../../../containers/ml/infra_ml_capabilities';
import { PrefilledInventoryAlertFlyout } from '../../inventory/components/alert_flyout';
import { PrefilledThresholdAlertFlyout } from '../../metric_threshold/components/alert_flyout';
import { PrefilledAnomalyAlertFlyout } from '../../metric_anomaly/components/alert_flyout';
import { useLinkProps } from '../../../hooks/use_link_props';

type VisibleFlyoutType = 'inventory' | 'threshold' | 'anomaly' | null;
type VisibleFlyoutType = 'inventory' | 'threshold' | null;

export const MetricsAlertDropdown = () => {
const [popoverOpen, setPopoverOpen] = useState(false);
const [visibleFlyoutType, setVisibleFlyoutType] = useState<VisibleFlyoutType>(null);
const { hasInfraMLCapabilities } = useInfraMLCapabilities();

const closeFlyout = useCallback(() => setVisibleFlyoutType(null), [setVisibleFlyoutType]);

Expand Down Expand Up @@ -75,16 +72,7 @@ export const MetricsAlertDropdown = () => {
}),
onClick: () => setVisibleFlyoutType('inventory'),
},
].concat(
hasInfraMLCapabilities
? {
name: i18n.translate('xpack.infra.alerting.createAnomalyAlertButton', {
defaultMessage: 'Create anomaly alert',
}),
onClick: () => setVisibleFlyoutType('anomaly'),
}
: []
),
],
},
{
id: 2,
Expand All @@ -101,7 +89,7 @@ export const MetricsAlertDropdown = () => {
],
},
],
[manageAlertsLinkProps, setVisibleFlyoutType, hasInfraMLCapabilities]
[manageAlertsLinkProps, setVisibleFlyoutType]
);

const closePopover = useCallback(() => {
Expand Down Expand Up @@ -143,8 +131,6 @@ const AlertFlyout = ({ visibleFlyoutType, onClose }: AlertFlyoutProps) => {
return <PrefilledInventoryAlertFlyout onClose={onClose} />;
case 'threshold':
return <PrefilledThresholdAlertFlyout onClose={onClose} />;
case 'anomaly':
return <PrefilledAnomalyAlertFlyout onClose={onClose} />;
default:
return null;
}
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/infra/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { AppMountParameters, PluginInitializerContext } from 'kibana/public';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
import { createMetricThresholdAlertType } from './alerting/metric_threshold';
import { createInventoryMetricAlertType } from './alerting/inventory';
import { createMetricAnomalyAlertType } from './alerting/metric_anomaly';
import { getAlertType as getLogsAlertType } from './alerting/log_threshold';
import { registerFeatures } from './register_feature';
import {
Expand All @@ -36,7 +35,6 @@ export class Plugin implements InfraClientPluginClass {
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(createInventoryMetricAlertType());
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(getLogsAlertType());
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(createMetricThresholdAlertType());
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(createMetricAnomalyAlertType());

if (pluginsSetup.observability) {
pluginsSetup.observability.dashboard.register({
Expand Down