Skip to content

Commit

Permalink
Fix after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ersin-erdal committed Mar 19, 2024
1 parent 68a37e9 commit 669a932
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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));
}

0 comments on commit 669a932

Please sign in to comment.