mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[APM] Show all alerts in service views & service inventory for consistency with entity inventory (#202025)
## Summary Closes https://github.com/elastic/kibana/issues/201565 This update ensures that the service inventory and service views display all alerts grouped by `service.name`, regardless of index pattern. This provides consistent alert visibility across services. >[!NOTE] >The presence of two services with alerts in the "before" state, rather than one, is not due to any changes made in this PR, but rather because the alerts stopped being active while doing the screenshots. Screen|Before|After -|-|- Entity inventory|| Service inventory|| Service detail overview|| Service detail alerts||
This commit is contained in:
parent
1749c88f7d
commit
8084bd640e
8 changed files with 22 additions and 8 deletions
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { AlertConsumers, type ValidFeatureId } from '@kbn/rule-data-utils';
|
||||
|
||||
export const apmAlertingFeatureIds: ValidFeatureId[] = [
|
||||
AlertConsumers.LOGS,
|
||||
AlertConsumers.APM,
|
||||
AlertConsumers.SLO,
|
||||
AlertConsumers.OBSERVABILITY,
|
||||
AlertConsumers.INFRASTRUCTURE,
|
||||
];
|
|
@ -13,6 +13,7 @@ import { EuiPanel, EuiFlexItem, EuiFlexGroup } from '@elastic/eui';
|
|||
import { BoolQuery } from '@kbn/es-query';
|
||||
import { AlertConsumers } from '@kbn/rule-data-utils';
|
||||
import { useKibana } from '@kbn/kibana-react-plugin/public';
|
||||
import { apmAlertingFeatureIds } from '../../../../common/alerting/config/apm_alerting_feature_ids';
|
||||
import { ApmPluginStartDeps } from '../../../plugin';
|
||||
import { useAnyOfApmParams } from '../../../hooks/use_apm_params';
|
||||
import { SERVICE_NAME } from '../../../../common/es_fields/apm';
|
||||
|
@ -107,7 +108,7 @@ export function AlertsOverview() {
|
|||
alertsTableConfigurationRegistry={alertsTableConfigurationRegistry}
|
||||
id={'service-overview-alerts'}
|
||||
configurationId={AlertConsumers.OBSERVABILITY}
|
||||
featureIds={[AlertConsumers.APM, AlertConsumers.OBSERVABILITY]}
|
||||
featureIds={apmAlertingFeatureIds}
|
||||
query={esQuery}
|
||||
showAlertStatusWithFlapping
|
||||
cellContext={{ observabilityRuleTypeRegistry }}
|
||||
|
|
|
@ -12,6 +12,7 @@ import { DataTier } from '@kbn/observability-shared-plugin/common';
|
|||
import { searchExcludedDataTiers } from '@kbn/observability-plugin/common/ui_settings_keys';
|
||||
import { estypes } from '@elastic/elasticsearch';
|
||||
import { getDataTierFilterCombined } from '@kbn/apm-data-access-plugin/server/utils';
|
||||
import { apmAlertingFeatureIds } from '../../../common/alerting/config/apm_alerting_feature_ids';
|
||||
import type { MinimalAPMRouteHandlerResources } from '../../routes/apm_routes/register_apm_server_routes';
|
||||
|
||||
export type ApmAlertsClient = Awaited<ReturnType<typeof getApmAlertsClient>>;
|
||||
|
@ -31,7 +32,7 @@ export async function getApmAlertsClient({
|
|||
|
||||
const ruleRegistryPluginStart = await plugins.ruleRegistry.start();
|
||||
const alertsClient = await ruleRegistryPluginStart.getRacClientWithRequest(request);
|
||||
const apmAlertsIndices = await alertsClient.getAuthorizedAlertsIndices(['apm']);
|
||||
const apmAlertsIndices = await alertsClient.getAuthorizedAlertsIndices(apmAlertingFeatureIds);
|
||||
|
||||
if (!apmAlertsIndices || isEmpty(apmAlertsIndices)) {
|
||||
throw Error('No alert indices exist for "apm"');
|
||||
|
|
|
@ -129,7 +129,6 @@ describe('useDetailViewRedirect', () => {
|
|||
expect(url).toBe('service-overview-url');
|
||||
expect(mockGetRedirectUrl).toHaveBeenCalledWith({
|
||||
serviceName: 'service-1',
|
||||
environment: 'prod',
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -65,9 +65,6 @@ export const useDetailViewRedirect = () => {
|
|||
if (isBuiltinEntityOfType('service', entity)) {
|
||||
return serviceOverviewLocator?.getRedirectUrl({
|
||||
serviceName: identityFieldsValue[identityFields[0]],
|
||||
environment: entity.service?.environment
|
||||
? castArray(entity.service?.environment)[0]
|
||||
: undefined,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { termQuery } from '@kbn/observability-plugin/server';
|
||||
import { ALERT_STATUS, ALERT_STATUS_ACTIVE } from '@kbn/rule-data-utils';
|
||||
import { AlertsClient } from '../../lib/create_alerts_client.ts/create_alerts_client';
|
||||
import { AlertsClient } from '../../lib/create_alerts_client/create_alerts_client';
|
||||
import { getGroupByTermsAgg } from './get_group_by_terms_agg';
|
||||
import { IdentityFieldsPerEntityType } from './get_identity_fields_per_entity_type';
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import { createObservabilityEsClient } from '@kbn/observability-utils-server/es/
|
|||
import * as t from 'io-ts';
|
||||
import { orderBy } from 'lodash';
|
||||
import { InventoryEntity, entityColumnIdsRt } from '../../../common/entities';
|
||||
import { createAlertsClient } from '../../lib/create_alerts_client.ts/create_alerts_client';
|
||||
import { createAlertsClient } from '../../lib/create_alerts_client/create_alerts_client';
|
||||
import { createInventoryServerRoute } from '../create_inventory_server_route';
|
||||
import { getEntityGroupsBy } from './get_entity_groups';
|
||||
import { getEntityTypes } from './get_entity_types';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue