Skip to content

Commit

Permalink
refactor: apply PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rmyz committed Nov 29, 2024
1 parent eb0e32b commit bee9a26
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const METRICS_FEATURE_ID = AlertConsumers.INFRASTRUCTURE;
export const INFRA_ALERT_FEATURE_ID = AlertConsumers.INFRASTRUCTURE;
export const LOGS_FEATURE_ID = AlertConsumers.LOGS;

export const INFRA_ALERT_FEATUREIDS: ValidFeatureId[] = [
export const INFRA_ALERT_FEATURE_IDS: ValidFeatureId[] = [
AlertConsumers.INFRASTRUCTURE,
AlertConsumers.OBSERVABILITY,
AlertConsumers.LOGS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import {
} from '@kbn/rule-data-utils';
import type { Filter } from '@kbn/es-query';
import type { AlertStatus } from '@kbn/observability-plugin/common/typings';

import { INFRA_ALERT_FEATUREIDS } from '../../../../common/constants';
import { INFRA_ALERT_FEATURE_IDS } from '../../../../common/constants';

export const ALERT_STATUS_ALL = 'all';

Expand Down Expand Up @@ -88,4 +87,4 @@ export const ALERTS_PATH = '/app/observability/alerts';
export const ALERTS_PER_PAGE = 10;
export const ALERTS_TABLE_ID = 'xpack.infra.hosts.alerts.table';

export const infraAlertFeatureIds = INFRA_ALERT_FEATUREIDS;
export const infraAlertFeatureIds = INFRA_ALERT_FEATURE_IDS;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { isEmpty } from 'lodash';
import type { ESSearchRequest, InferSearchResponseOf } from '@kbn/es-types';
import { ParsedTechnicalFields } from '@kbn/rule-registry-plugin/common';
import type { KibanaRequest } from '@kbn/core/server';
import { INFRA_ALERT_FEATUREIDS } from '../../../common/constants';
import { INFRA_ALERT_FEATURE_IDS } from '../../../common/constants';
import type { InfraBackendLibs } from '../infra_types';

type RequiredParams = ESSearchRequest & {
Expand All @@ -27,7 +27,7 @@ export async function getInfraAlertsClient({
}) {
const [, { ruleRegistry }] = await libs.getStartServices();
const alertsClient = await ruleRegistry.getRacClientWithRequest(request);
const infraAlertsIndices = await alertsClient.getAuthorizedAlertsIndices(INFRA_ALERT_FEATUREIDS);
const infraAlertsIndices = await alertsClient.getAuthorizedAlertsIndices(INFRA_ALERT_FEATURE_IDS);

if (!infraAlertsIndices || isEmpty(infraAlertsIndices)) {
throw Error('No alert indices exist for "infrastructure"');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ALERT_STATUS_ACTIVE,
ALERT_UUID,
} from '@kbn/rule-data-utils';
import { HOST_NAME_FIELD, INFRA_ALERT_FEATUREIDS } from '../../../../../common/constants';
import { HOST_NAME_FIELD, INFRA_ALERT_FEATURE_IDS } from '../../../../../common/constants';
import { GetHostParameters } from '../types';

export async function getHostsAlertsCount({
Expand Down Expand Up @@ -40,7 +40,7 @@ export async function getHostsAlertsCount({
query: {
bool: {
filter: [
...termsQuery(ALERT_RULE_PRODUCER, ...INFRA_ALERT_FEATUREIDS),
...termsQuery(ALERT_RULE_PRODUCER, ...INFRA_ALERT_FEATURE_IDS),
...termQuery(ALERT_STATUS, ALERT_STATUS_ACTIVE),
...termsQuery(HOST_NAME_FIELD, ...hostNames),
...rangeQuery,
Expand Down

0 comments on commit bee9a26

Please sign in to comment.