Skip to content

Commit

Permalink
Revert "[8.x] [Response Ops][Alerting] Creating global service for fe…
Browse files Browse the repository at this point in the history
…tching and caching rules settings (elastic#192404) (elastic#193011)"

This reverts commit 7939f22.
  • Loading branch information
mikecote committed Sep 20, 2024
1 parent 9a6a4e5 commit 7655d92
Show file tree
Hide file tree
Showing 38 changed files with 157 additions and 563 deletions.
3 changes: 0 additions & 3 deletions x-pack/plugins/alerting/server/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ describe('config validation', () => {
},
},
},
"rulesSettings": Object {
"cacheInterval": 60000,
},
}
`);
});
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugins/alerting/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import { schema, TypeOf } from '@kbn/config-schema';
import { validateDurationSchema, parseDuration } from './lib';
import { DEFAULT_CACHE_INTERVAL_MS } from './rules_settings';

export const DEFAULT_MAX_ALERTS = 1000;
const ONE_DAY_IN_MS = 24 * 60 * 60 * 1000;
Expand Down Expand Up @@ -75,9 +74,6 @@ export const configSchema = schema.object({
enableFrameworkAlerts: schema.boolean({ defaultValue: true }),
cancelAlertsOnRuleTimeout: schema.boolean({ defaultValue: true }),
rules: rulesSchema,
rulesSettings: schema.object({
cacheInterval: schema.number({ defaultValue: DEFAULT_CACHE_INTERVAL_MS }),
}),
});

export type AlertingConfig = TypeOf<typeof configSchema>;
Expand Down
48 changes: 20 additions & 28 deletions x-pack/plugins/alerting/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ import { ServerlessPluginSetup } from '@kbn/serverless/server';
import { RuleTypeRegistry } from './rule_type_registry';
import { TaskRunnerFactory } from './task_runner';
import { RulesClientFactory } from './rules_client_factory';
import {
RulesSettingsClientFactory,
RulesSettingsService,
getRulesSettingsFeature,
} from './rules_settings';
import { RulesSettingsClientFactory } from './rules_settings_client_factory';
import { MaintenanceWindowClientFactory } from './maintenance_window_client_factory';
import { ILicenseState, LicenseState } from './lib/license_state';
import { AlertingRequestHandlerContext, ALERTING_FEATURE_ID, RuleAlertData } from './types';
Expand Down Expand Up @@ -110,6 +106,7 @@ import {
type InitializationPromise,
errorResult,
} from './alerts_service';
import { getRulesSettingsFeature } from './rules_settings_feature';
import { maintenanceWindowFeature } from './maintenance_window_feature';
import { ConnectorAdapterRegistry } from './connector_adapters/connector_adapter_registry';
import { ConnectorAdapter, ConnectorAdapterParams } from './connector_adapters/types';
Expand Down Expand Up @@ -591,38 +588,33 @@ export class AlertingPlugin {
};

taskRunnerFactory.initialize({
actionsConfigMap: getActionsConfigMap(this.config.rules.run.actions),
actionsPlugin: plugins.actions,
alertsService: this.alertsService,
backfillClient: this.backfillClient!,
basePathService: core.http.basePath,
cancelAlertsOnRuleTimeout: this.config.cancelAlertsOnRuleTimeout,
connectorAdapterRegistry: this.connectorAdapterRegistry,
logger,
data: plugins.data,
share: plugins.share,
dataViews: plugins.dataViews,
savedObjects: core.savedObjects,
uiSettings: core.uiSettings,
elasticsearch: core.elasticsearch,
getRulesClientWithRequest,
spaceIdToNamespace,
actionsPlugin: plugins.actions,
encryptedSavedObjectsClient,
basePathService: core.http.basePath,
eventLogger: this.eventLogger!,
executionContext: core.executionContext,
getMaintenanceWindowClientWithRequest,
getRulesClientWithRequest,
kibanaBaseUrl: this.kibanaBaseUrl,
logger,
maxAlerts: this.config.rules.run.alerts.max,
maxEphemeralActionsPerRule: this.config.maxEphemeralActionsPerAlert,
ruleTypeRegistry: this.ruleTypeRegistry!,
rulesSettingsService: new RulesSettingsService({
cacheInterval: this.config.rulesSettings.cacheInterval,
getRulesSettingsClientWithRequest,
isServerless: !!plugins.serverless,
logger,
}),
savedObjects: core.savedObjects,
share: plugins.share,
spaceIdToNamespace,
alertsService: this.alertsService,
kibanaBaseUrl: this.kibanaBaseUrl,
supportsEphemeralTasks: plugins.taskManager.supportsEphemeralTasks(),
uiSettings: core.uiSettings,
maxEphemeralActionsPerRule: this.config.maxEphemeralActionsPerAlert,
cancelAlertsOnRuleTimeout: this.config.cancelAlertsOnRuleTimeout,
maxAlerts: this.config.rules.run.alerts.max,
actionsConfigMap: getActionsConfigMap(this.config.rules.run.actions),
usageCounter: this.usageCounter,
getRulesSettingsClientWithRequest,
getMaintenanceWindowClientWithRequest,
backfillClient: this.backfillClient!,
connectorAdapterRegistry: this.connectorAdapterRegistry,
});

this.eventLogService!.registerSavedObjectProvider(RULE_SAVED_OBJECT_TYPE, (request) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import { httpServerMock } from '@kbn/core/server/mocks';
import { actionsClientMock } from '@kbn/actions-plugin/server/mocks';
import type { ActionsClientMock } from '@kbn/actions-plugin/server/mocks';
import { rulesClientMock, RulesClientMock } from '../rules_client.mock';
import {
rulesSettingsClientMock,
RulesSettingsClientMock,
} from '../rules_settings/rules_settings_client.mock';
import { rulesSettingsClientMock, RulesSettingsClientMock } from '../rules_settings_client.mock';
import {
maintenanceWindowClientMock,
MaintenanceWindowClientMock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
import { httpServiceMock } from '@kbn/core/server/mocks';
import { licenseStateMock } from '../lib/license_state.mock';
import { mockHandlerArguments } from './_mock_handler_arguments';
import {
rulesSettingsClientMock,
RulesSettingsClientMock,
} from '../rules_settings/rules_settings_client.mock';
import { rulesSettingsClientMock, RulesSettingsClientMock } from '../rules_settings_client.mock';
import { getFlappingSettingsRoute } from './get_flapping_settings';

let rulesSettingsClient: RulesSettingsClientMock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { mockHandlerArguments } from '../../../_mock_handler_arguments';
import {
rulesSettingsClientMock,
RulesSettingsClientMock,
} from '../../../../rules_settings/rules_settings_client.mock';
} from '../../../../rules_settings_client.mock';
import { getQueryDelaySettingsRoute } from './get_query_delay_settings';

let rulesSettingsClient: RulesSettingsClientMock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { mockHandlerArguments } from '../../../_mock_handler_arguments';
import {
rulesSettingsClientMock,
RulesSettingsClientMock,
} from '../../../../rules_settings/rules_settings_client.mock';
} from '../../../../rules_settings_client.mock';
import { updateQueryDelaySettingsRoute } from './update_query_delay_settings';

let rulesSettingsClient: RulesSettingsClientMock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
import { httpServiceMock } from '@kbn/core/server/mocks';
import { licenseStateMock } from '../lib/license_state.mock';
import { mockHandlerArguments } from './_mock_handler_arguments';
import {
rulesSettingsClientMock,
RulesSettingsClientMock,
} from '../rules_settings/rules_settings_client.mock';
import { rulesSettingsClientMock, RulesSettingsClientMock } from '../rules_settings_client.mock';
import { updateFlappingSettingsRoute } from './update_flapping_settings';

let rulesSettingsClient: RulesSettingsClientMock;
Expand Down

This file was deleted.

Loading

0 comments on commit 7655d92

Please sign in to comment.