[ResponseOps][Alerts] Update stack alerts page feature labels and filters (#184305)

## Summary

Updates the alerts table feature cell renderers and feature filters
according to #183615.

## To verify

1. Create some Stack, Stack Monitoring, and ML rules that fire alerts
2. Navigate to `Stack Management` > `Alerts`
3. Verify that the feature quick filter (found in the <img width="22"
alt="image"
src="847c3fc4-1c23-4846-ae32-d66b10de7ad5">
menu of the KQL bar) respects the changes outlined in points 1 and 2 of
#183615
4. Verify that the alerts from Stack rules show a `Stack` label in the
table
6. Verify that the alerts from Stack Monitoring rules show a `Stack
Monitoring` label in the table
7. Verify that filtering by `Stack rule types` shows only Stack and ML
alerts in the table
8. Verify that filtering by `Observability rule types` doesn't show
Stack Monitoring alerts
9. Verify that filtering by `Stack Monitoring rule types` only shows
Stack Monitoring alerts

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Umberto Pepato 2024-06-04 09:18:02 +02:00 committed by GitHub
parent f689c1dd3e
commit a8b2eef204
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 29 additions and 32 deletions

View file

@ -42282,7 +42282,7 @@
"xpack.triggersActionsUI.sections.alertsTable.observability": "Observabilité",
"xpack.triggersActionsUI.sections.alertsTable.security": "Sécurité",
"xpack.triggersActionsUI.sections.alertsTable.slos": "SLO",
"xpack.triggersActionsUI.sections.alertsTable.stackManagement": "Gestion de la Suite",
"xpack.triggersActionsUI.sections.alertsTable.stack": "Gestion de la Suite",
"xpack.triggersActionsUI.sections.alertsTable.stackMonitoring": "Monitoring de la Suite",
"xpack.triggersActionsUI.sections.alertsTable.title": "Tableau dalertes",
"xpack.triggersActionsUI.sections.alertsTable.uptime": "Uptime",

View file

@ -42252,7 +42252,7 @@
"xpack.triggersActionsUI.sections.alertsTable.observability": "Observability",
"xpack.triggersActionsUI.sections.alertsTable.security": "セキュリティ",
"xpack.triggersActionsUI.sections.alertsTable.slos": "SLO",
"xpack.triggersActionsUI.sections.alertsTable.stackManagement": "スタック管理",
"xpack.triggersActionsUI.sections.alertsTable.stack": "スタック管理",
"xpack.triggersActionsUI.sections.alertsTable.stackMonitoring": "スタック監視",
"xpack.triggersActionsUI.sections.alertsTable.title": "アラートテーブル",
"xpack.triggersActionsUI.sections.alertsTable.uptime": "アップタイム",

View file

@ -42300,7 +42300,7 @@
"xpack.triggersActionsUI.sections.alertsTable.observability": "Observability",
"xpack.triggersActionsUI.sections.alertsTable.security": "安全",
"xpack.triggersActionsUI.sections.alertsTable.slos": "SLO",
"xpack.triggersActionsUI.sections.alertsTable.stackManagement": "Stack Management",
"xpack.triggersActionsUI.sections.alertsTable.stack": "Stack Management",
"xpack.triggersActionsUI.sections.alertsTable.stackMonitoring": "堆栈监测",
"xpack.triggersActionsUI.sections.alertsTable.title": "告警表",
"xpack.triggersActionsUI.sections.alertsTable.uptime": "运行时间",

View file

@ -14,7 +14,12 @@ import { AlertConsumers } from '@kbn/rule-data-utils';
describe('useRuleTypeIdsByFeatureId', () => {
it('should correctly reverse the rule types index', () => {
const { result } = renderHook(() => useRuleTypeIdsByFeatureId(ruleTypesIndex));
expect(Object.keys(result.current)).toEqual(['stackAlerts', 'observability', 'ml', 'siem']);
expect(Object.keys(result.current)).toEqual([
'stackAlerts',
'observability',
'monitoring',
'siem',
]);
Object.values(result.current).forEach((ruleTypes) => {
expect(ruleTypes).not.toHaveLength(0);
});
@ -35,20 +40,6 @@ describe('useRuleTypeIdsByFeatureId', () => {
'metrics.alert.inventory.threshold',
'observability.rules.custom_threshold',
'logs.alert.document.count',
'monitoring_alert_license_expiration',
'monitoring_alert_cluster_health',
'monitoring_alert_cpu_usage',
'monitoring_alert_disk_usage',
'monitoring_alert_nodes_changed',
'monitoring_alert_elasticsearch_version_mismatch',
'monitoring_alert_kibana_version_mismatch',
'monitoring_alert_logstash_version_mismatch',
'monitoring_alert_jvm_memory_usage',
'monitoring_alert_missing_monitoring_data',
'monitoring_alert_thread_pool_search_rejections',
'monitoring_alert_thread_pool_write_rejections',
'monitoring_ccr_read_exceptions',
'monitoring_shard_size',
'apm.error_rate',
'apm.transaction_error_rate',
'apm.transaction_duration',

View file

@ -8,7 +8,7 @@
import { AlertConsumers } from '@kbn/rule-data-utils';
import { useMemo } from 'react';
import { mapValues } from 'lodash';
import { observabilityFeatureIds } from '../../alerts_table/constants';
import { observabilityFeatureIds, stackFeatureIds } from '../../alerts_table/constants';
import { MULTI_CONSUMER_RULE_TYPE_IDS } from '../../../constants';
import { RuleTypeIndex } from '../../../../types';
@ -33,10 +33,14 @@ export const useRuleTypeIdsByFeatureId = (ruleTypesIndex: RuleTypeIndex) =>
const map = Array.from(ruleTypesIndex.entries()).reduce<RuleTypeIdsByFeatureId<Set<string>>>(
(types, [key, value]) => {
let producer = value.producer as keyof RuleTypeIdsByFeatureId;
// All o11y apps are listed under 'observability' to create a grouped filter
producer = observabilityFeatureIds.includes(producer)
? AlertConsumers.OBSERVABILITY
: producer;
// Some o11y apps are listed under 'observability' to create a grouped filter
if (observabilityFeatureIds.includes(producer)) {
producer = AlertConsumers.OBSERVABILITY;
}
// Stack includes ML in this context
if (stackFeatureIds.includes(producer)) {
producer = AlertConsumers.STACK_ALERTS;
}
// Multi consumer rule type ids should be listed both in Observability and Stack alerts
if (MULTI_CONSUMER_RULE_TYPE_IDS.includes(value.id)) {
(types[AlertConsumers.OBSERVABILITY] =

View file

@ -15,7 +15,7 @@ import {
OBSERVABILITY_DISPLAY_NAME,
SECURITY_DISPLAY_NAME,
SLO_DISPLAY_NAME,
STACK_MANAGEMENT_DISPLAY_NAME,
STACK_DISPLAY_NAME,
STACK_MONITORING_DISPLAY_NAME,
UPTIME_DISPLAY_NAME,
} from '../translations';
@ -33,9 +33,10 @@ export const observabilityFeatureIds: AlertConsumers[] = [
AlertConsumers.LOGS,
AlertConsumers.SLO,
AlertConsumers.UPTIME,
AlertConsumers.MONITORING,
];
export const stackFeatureIds: AlertConsumers[] = [AlertConsumers.STACK_ALERTS, AlertConsumers.ML];
export const [_, ...observabilityApps] = observabilityFeatureIds;
export const alertProducersData: Record<AlertConsumers, AlertProducerData> = {
@ -77,8 +78,9 @@ export const alertProducersData: Record<AlertConsumers, AlertProducerData> = {
icon: 'logoSecurity',
},
[AlertConsumers.STACK_ALERTS]: {
displayName: STACK_MANAGEMENT_DISPLAY_NAME,
displayName: STACK_DISPLAY_NAME,
icon: 'managementApp',
subFeatureIds: stackFeatureIds,
},
[AlertConsumers.EXAMPLE]: {
displayName: 'Example',

View file

@ -32,17 +32,17 @@ export const SECURITY_DISPLAY_NAME = i18n.translate(
}
);
export const STACK_MANAGEMENT_DISPLAY_NAME = i18n.translate(
'xpack.triggersActionsUI.sections.alertsTable.stackManagement',
export const STACK_DISPLAY_NAME = i18n.translate(
'xpack.triggersActionsUI.sections.alertsTable.stack',
{
defaultMessage: 'Stack management',
defaultMessage: 'Stack',
}
);
export const STACK_MONITORING_DISPLAY_NAME = i18n.translate(
'xpack.triggersActionsUI.sections.alertsTable.stackMonitoring',
{
defaultMessage: 'Stack monitoring',
defaultMessage: 'Stack Monitoring',
}
);

View file

@ -9,7 +9,6 @@ import { FtrProviderContext } from '../../ftr_provider_context';
export default ({ loadTestFile }: FtrProviderContext) => {
describe('Actions and Triggers app', function () {
loadTestFile(require.resolve('./alerts_page'));
loadTestFile(require.resolve('./home_page'));
loadTestFile(require.resolve('./rules_list'));
loadTestFile(require.resolve('./alert_create_flyout'));
@ -17,6 +16,7 @@ export default ({ loadTestFile }: FtrProviderContext) => {
loadTestFile(require.resolve('./connectors'));
loadTestFile(require.resolve('./logs_list'));
loadTestFile(require.resolve('./rules_settings'));
loadTestFile(require.resolve('./stack_alerts_page'));
loadTestFile(require.resolve('./maintenance_windows'));
});
};

View file

@ -64,7 +64,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const quickFilters = await pageObjects.triggersActionsUI.getAlertsPageQuickFilters();
const solutionFilters = getSolutionNamesFromFilters(quickFilters);
expect(solutionFilters).to.have.length(2);
expect(solutionFilters[0]).to.equal('Stack management');
expect(solutionFilters[0]).to.equal('Stack');
// Observability is included because of multi-consumer rules
expect(solutionFilters[1]).to.equal('Observability');
});