From 669a932f474645e4c75ff44d3a6317a94892addc Mon Sep 17 00:00:00 2001 From: Ersin Erdal Date: Tue, 19 Mar 2024 16:28:13 +0100 Subject: [PATCH] Fix after merge --- .../server/lib/rules/register_rule_types.ts | 3 -- .../lib/rules/register_burn_rate_rule.ts | 35 ++----------------- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/register_rule_types.ts b/x-pack/plugins/observability_solution/observability/server/lib/rules/register_rule_types.ts index 61cc6c54404f6..bc3611ac216c7 100644 --- a/x-pack/plugins/observability_solution/observability/server/lib/rules/register_rule_types.ts +++ b/x-pack/plugins/observability_solution/observability/server/lib/rules/register_rule_types.ts @@ -18,7 +18,6 @@ import { CustomThresholdLocators } from './custom_threshold/custom_threshold_exe import { observabilityFeatureId } from '../../../common'; import { ObservabilityConfig } from '../..'; import { THRESHOLD_RULE_REGISTRATION_CONTEXT } from '../../common/constants'; -import { sloBurnRateRuleType } from './slo_burn_rate'; import { thresholdRuleType } from './custom_threshold/register_custom_threshold_rule_type'; export function registerRuleTypes( @@ -29,8 +28,6 @@ export function registerRuleTypes( ruleDataService: IRuleDataService, locators: CustomThresholdLocators ) { - alertingPlugin.registerType(sloBurnRateRuleType(basePath, locators.alertsLocator)); - const ruleDataClientThreshold = ruleDataService.initializeIndex({ feature: observabilityFeatureId, registrationContext: THRESHOLD_RULE_REGISTRATION_CONTEXT, diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/register_burn_rate_rule.ts b/x-pack/plugins/observability_solution/slo/server/lib/rules/register_burn_rate_rule.ts index 8ddaffdc05fad..d432dc5c52d34 100644 --- a/x-pack/plugins/observability_solution/slo/server/lib/rules/register_burn_rate_rule.ts +++ b/x-pack/plugins/observability_solution/slo/server/lib/rules/register_burn_rate_rule.ts @@ -7,18 +7,9 @@ import { PluginSetupContract } from '@kbn/alerting-plugin/server'; import { IBasePath, Logger } from '@kbn/core/server'; -import { - createLifecycleExecutor, - Dataset, - IRuleDataService, -} from '@kbn/rule-registry-plugin/server'; -import { mappingFromFieldMap } from '@kbn/alerting-plugin/common'; -import { legacyExperimentalFieldMap } from '@kbn/alerts-as-data-utils'; +import { IRuleDataService } from '@kbn/rule-registry-plugin/server'; import { CustomThresholdLocators } from '@kbn/observability-plugin/server'; -import { sloFeatureId } from '@kbn/observability-plugin/common'; -import { SLO_RULE_REGISTRATION_CONTEXT } from '../../common/constants'; import { sloBurnRateRuleType } from './slo_burn_rate'; -import { sloRuleFieldMap } from './slo_burn_rate/field_map'; export function registerBurnRateRule( alertingPlugin: PluginSetupContract, @@ -28,27 +19,5 @@ export function registerBurnRateRule( locators: CustomThresholdLocators // TODO move this somewhere else, or use only alertsLocator ) { // SLO RULE - const ruleDataClientSLO = ruleDataService.initializeIndex({ - feature: sloFeatureId, - registrationContext: SLO_RULE_REGISTRATION_CONTEXT, - dataset: Dataset.alerts, - componentTemplateRefs: [], - componentTemplates: [ - { - name: 'mappings', - mappings: mappingFromFieldMap( - { ...legacyExperimentalFieldMap, ...sloRuleFieldMap }, - 'strict' - ), - }, - ], - }); - - const createLifecycleRuleExecutorSLO = createLifecycleExecutor( - logger.get('rules'), - ruleDataClientSLO - ); - alertingPlugin.registerType( - sloBurnRateRuleType(createLifecycleRuleExecutorSLO, basePath, locators.alertsLocator) - ); + alertingPlugin.registerType(sloBurnRateRuleType(basePath, locators.alertsLocator)); }