mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Rule registry bundle size (#97251)
This commit is contained in:
parent
1a3e033c90
commit
fed17c2b6e
26 changed files with 169 additions and 110 deletions
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ValuesType } from 'utility-types';
|
||||
import { ActionGroup } from '../../alerting/common';
|
||||
import { ANOMALY_SEVERITY, ANOMALY_THRESHOLD } from '../../ml/common';
|
||||
import type { ValuesType } from 'utility-types';
|
||||
import type { ActionGroup } from '../../alerting/common';
|
||||
import { ANOMALY_SEVERITY, ANOMALY_THRESHOLD } from './ml_constants';
|
||||
|
||||
export enum AlertType {
|
||||
ErrorCount = 'apm.error_rate', // ErrorRate was renamed to ErrorCount but the key is kept as `error_rate` for backwards-compat.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ANOMALY_SEVERITY } from '../../ml/common';
|
||||
import { ANOMALY_SEVERITY } from './ml_constants';
|
||||
import {
|
||||
getSeverityType,
|
||||
getSeverityColor as mlGetSeverityColor,
|
||||
|
|
24
x-pack/plugins/apm/common/ml_constants.ts
Normal file
24
x-pack/plugins/apm/common/ml_constants.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// copied from ml/common, to keep the bundle size small
|
||||
export enum ANOMALY_SEVERITY {
|
||||
CRITICAL = 'critical',
|
||||
MAJOR = 'major',
|
||||
MINOR = 'minor',
|
||||
WARNING = 'warning',
|
||||
LOW = 'low',
|
||||
UNKNOWN = 'unknown',
|
||||
}
|
||||
|
||||
export enum ANOMALY_THRESHOLD {
|
||||
CRITICAL = 75,
|
||||
MAJOR = 50,
|
||||
MINOR = 25,
|
||||
WARNING = 3,
|
||||
LOW = 0,
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
const plainApmRuleRegistrySettings = {
|
||||
name: 'apm',
|
||||
fieldMap: {
|
||||
'service.environment': {
|
||||
type: 'keyword',
|
||||
},
|
||||
'transaction.type': {
|
||||
type: 'keyword',
|
||||
},
|
||||
'processor.event': {
|
||||
type: 'keyword',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
type APMRuleRegistrySettings = typeof plainApmRuleRegistrySettings;
|
||||
|
||||
export const apmRuleRegistrySettings: APMRuleRegistrySettings = plainApmRuleRegistrySettings;
|
20
x-pack/plugins/apm/common/rules/apm_rule_field_map.ts
Normal file
20
x-pack/plugins/apm/common/rules/apm_rule_field_map.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export const apmRuleFieldMap = {
|
||||
'service.environment': {
|
||||
type: 'keyword',
|
||||
},
|
||||
'transaction.type': {
|
||||
type: 'keyword',
|
||||
},
|
||||
'processor.event': {
|
||||
type: 'keyword',
|
||||
},
|
||||
} as const;
|
||||
|
||||
export type APMRuleFieldMap = typeof apmRuleFieldMap;
|
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export const apmRuleRegistrySettings = {
|
||||
name: 'apm',
|
||||
};
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiTheme } from '../../../../src/plugins/kibana_react/common';
|
||||
import { ANOMALY_SEVERITY } from '../../ml/common';
|
||||
import { ANOMALY_SEVERITY } from './ml_constants';
|
||||
|
||||
export enum ServiceHealthStatus {
|
||||
healthy = 'healthy',
|
||||
|
|
|
@ -7,11 +7,20 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { lazy } from 'react';
|
||||
import { format } from 'url';
|
||||
import { stringify } from 'querystring';
|
||||
import { ENVIRONMENT_ALL } from '../../../common/environment_filter_values';
|
||||
import { asDuration, asPercent } from '../../../common/utils/formatters';
|
||||
import { AlertType } from '../../../common/alert_types';
|
||||
import { ApmRuleRegistry } from '../../plugin';
|
||||
import type { ApmRuleRegistry } from '../../plugin';
|
||||
|
||||
const format = ({
|
||||
pathname,
|
||||
query,
|
||||
}: {
|
||||
pathname: string;
|
||||
query: Record<string, any>;
|
||||
}): string => {
|
||||
return `${pathname}?${stringify(query)}`;
|
||||
};
|
||||
|
||||
export function registerApmAlerts(apmRuleRegistry: ApmRuleRegistry) {
|
||||
apmRuleRegistry.registerType({
|
||||
|
@ -71,7 +80,7 @@ export function registerApmAlerts(apmRuleRegistry: ApmRuleRegistry) {
|
|||
'Alert when the latency of a specific transaction type in a service exceeds a defined threshold.',
|
||||
}
|
||||
),
|
||||
format: ({ alert }) => ({
|
||||
format: ({ alert, formatters: { asDuration } }) => ({
|
||||
reason: i18n.translate(
|
||||
'xpack.apm.alertTypes.transactionDuration.reason',
|
||||
{
|
||||
|
@ -131,7 +140,7 @@ export function registerApmAlerts(apmRuleRegistry: ApmRuleRegistry) {
|
|||
'Alert when the rate of transaction errors in a service exceeds a defined threshold.',
|
||||
}
|
||||
),
|
||||
format: ({ alert }) => ({
|
||||
format: ({ alert, formatters: { asPercent } }) => ({
|
||||
reason: i18n.translate(
|
||||
'xpack.apm.alertTypes.transactionErrorRate.reason',
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { useParams } from 'react-router-dom';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import React from 'react';
|
||||
import { ANOMALY_SEVERITY } from '../../../../../ml/common';
|
||||
import { ANOMALY_SEVERITY } from '../../../../common/ml_constants';
|
||||
import { useEnvironmentsFetcher } from '../../../hooks/use_environments_fetcher';
|
||||
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
|
||||
import { ServiceAlertTrigger } from '../service_alert_trigger';
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { render } from '@testing-library/react';
|
||||
import React, { ReactNode } from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { ANOMALY_SEVERITY } from '../../../../../ml/common';
|
||||
import { ANOMALY_SEVERITY } from '../../../../common/ml_constants';
|
||||
import { SelectAnomalySeverity } from './select_anomaly_severity';
|
||||
|
||||
function Wrapper({ children }: { children?: ReactNode }) {
|
||||
|
|
|
@ -5,13 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ConfigSchema } from '.';
|
||||
import {
|
||||
FetchDataParams,
|
||||
FormatterRuleRegistry,
|
||||
HasDataParams,
|
||||
ObservabilityPublicSetup,
|
||||
} from '../../observability/public';
|
||||
import type { ConfigSchema } from '.';
|
||||
import {
|
||||
AppMountParameters,
|
||||
CoreSetup,
|
||||
|
@ -20,28 +14,35 @@ import {
|
|||
Plugin,
|
||||
PluginInitializerContext,
|
||||
} from '../../../../src/core/public';
|
||||
import {
|
||||
import type {
|
||||
DataPublicPluginSetup,
|
||||
DataPublicPluginStart,
|
||||
} from '../../../../src/plugins/data/public';
|
||||
import { HomePublicPluginSetup } from '../../../../src/plugins/home/public';
|
||||
import {
|
||||
import type { EmbeddableStart } from '../../../../src/plugins/embeddable/public';
|
||||
import type { HomePublicPluginSetup } from '../../../../src/plugins/home/public';
|
||||
import type {
|
||||
PluginSetupContract as AlertingPluginPublicSetup,
|
||||
PluginStartContract as AlertingPluginPublicStart,
|
||||
} from '../../alerting/public';
|
||||
import { FeaturesPluginSetup } from '../../features/public';
|
||||
import { LicensingPluginSetup } from '../../licensing/public';
|
||||
import {
|
||||
import type { FeaturesPluginSetup } from '../../features/public';
|
||||
import type { LicensingPluginSetup } from '../../licensing/public';
|
||||
import type { MapsStartApi } from '../../maps/public';
|
||||
import type { MlPluginSetup, MlPluginStart } from '../../ml/public';
|
||||
import type {
|
||||
FetchDataParams,
|
||||
HasDataParams,
|
||||
ObservabilityPublicSetup,
|
||||
} from '../../observability/public';
|
||||
import { FormatterRuleRegistry } from '../../observability/public';
|
||||
import type {
|
||||
TriggersAndActionsUIPublicPluginSetup,
|
||||
TriggersAndActionsUIPublicPluginStart,
|
||||
} from '../../triggers_actions_ui/public';
|
||||
import { apmRuleRegistrySettings } from '../common/rules/apm_rule_registry_settings';
|
||||
import type { APMRuleFieldMap } from '../common/rules/apm_rule_field_map';
|
||||
import { registerApmAlerts } from './components/alerting/register_apm_alerts';
|
||||
import { featureCatalogueEntry } from './featureCatalogueEntry';
|
||||
import { toggleAppLinkInNav } from './toggleAppLinkInNav';
|
||||
import { EmbeddableStart } from '../../../../src/plugins/embeddable/public';
|
||||
import { registerApmAlerts } from './components/alerting/register_apm_alerts';
|
||||
import { MlPluginSetup, MlPluginStart } from '../../ml/public';
|
||||
import { MapsStartApi } from '../../maps/public';
|
||||
import { apmRuleRegistrySettings } from '../common/rules';
|
||||
|
||||
export type ApmPluginSetup = ReturnType<ApmPlugin['setup']>;
|
||||
export type ApmRuleRegistry = ApmPluginSetup['ruleRegistry'];
|
||||
|
@ -162,6 +163,7 @@ export class ApmPlugin implements Plugin<ApmPluginSetup, ApmPluginStart> {
|
|||
|
||||
const apmRuleRegistry = plugins.observability.ruleRegistry.create({
|
||||
...apmRuleRegistrySettings,
|
||||
fieldMap: {} as APMRuleFieldMap,
|
||||
ctor: FormatterRuleRegistry,
|
||||
});
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
import { registerTransactionDurationAnomalyAlertType } from './register_transaction_duration_anomaly_alert_type';
|
||||
import { ANOMALY_SEVERITY } from '../../../../ml/common';
|
||||
import { ANOMALY_SEVERITY } from '../../../common/ml_constants';
|
||||
import { Job, MlPluginSetup } from '../../../../ml/server';
|
||||
import * as GetServiceAnomalies from '../service_map/get_service_anomalies';
|
||||
import { createRuleTypeMocks } from './test_utils';
|
||||
|
|
|
@ -18,7 +18,7 @@ import {
|
|||
TRANSACTION_TYPE,
|
||||
} from '../../../common/elasticsearch_fieldnames';
|
||||
import { asMutableArray } from '../../../common/utils/as_mutable_array';
|
||||
import { ANOMALY_SEVERITY } from '../../../../ml/common';
|
||||
import { ANOMALY_SEVERITY } from '../../../common/ml_constants';
|
||||
import { KibanaRequest } from '../../../../../../src/core/server';
|
||||
import {
|
||||
AlertType,
|
||||
|
|
|
@ -14,7 +14,7 @@ import { getBucketSize } from '../../helpers/get_bucket_size';
|
|||
import { Setup, SetupTimeRange } from '../../helpers/setup_request';
|
||||
import { anomalySeriesFetcher } from './fetcher';
|
||||
import { getMLJobIds } from '../../service_map/get_service_anomalies';
|
||||
import { ANOMALY_THRESHOLD } from '../../../../../ml/common';
|
||||
import { ANOMALY_THRESHOLD } from '../../../../common/ml_constants';
|
||||
import { withApmSpan } from '../../../utils/with_apm_span';
|
||||
|
||||
export async function getAnomalySeries({
|
||||
|
|
|
@ -42,7 +42,8 @@ import {
|
|||
} from './types';
|
||||
import { registerRoutes } from './routes/register_routes';
|
||||
import { getGlobalApmServerRouteRepository } from './routes/get_global_apm_server_route_repository';
|
||||
import { apmRuleRegistrySettings } from '../common/rules';
|
||||
import { apmRuleRegistrySettings } from '../common/rules/apm_rule_registry_settings';
|
||||
import { apmRuleFieldMap } from '../common/rules/apm_rule_field_map';
|
||||
|
||||
export type APMRuleRegistry = ReturnType<APMPlugin['setup']>['ruleRegistry'];
|
||||
|
||||
|
@ -151,9 +152,10 @@ export class APMPlugin
|
|||
config: await mergedConfig$.pipe(take(1)).toPromise(),
|
||||
});
|
||||
|
||||
const apmRuleRegistry = plugins.observability.ruleRegistry.create(
|
||||
apmRuleRegistrySettings
|
||||
);
|
||||
const apmRuleRegistry = plugins.observability.ruleRegistry.create({
|
||||
...apmRuleRegistrySettings,
|
||||
fieldMap: apmRuleFieldMap,
|
||||
});
|
||||
|
||||
registerApmAlerts({
|
||||
registry: apmRuleRegistry,
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* 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 { ecsFieldMap, pickWithPatterns } from '../../rule_registry/common';
|
||||
|
||||
export const observabilityRuleRegistrySettings = {
|
||||
name: 'observability',
|
||||
fieldMap: {
|
||||
...pickWithPatterns(ecsFieldMap, 'host.name', 'service.name'),
|
||||
'kibana.observability.evaluation.value': {
|
||||
type: 'scaled_float' as const,
|
||||
scaling_factor: 1000,
|
||||
},
|
||||
'kibana.observability.evaluation.threshold': {
|
||||
type: 'scaled_float' as const,
|
||||
scaling_factor: 1000,
|
||||
},
|
||||
},
|
||||
};
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 { ecsFieldMap, pickWithPatterns } from '../../../rule_registry/common';
|
||||
|
||||
export const observabilityRuleFieldMap = {
|
||||
...pickWithPatterns(ecsFieldMap, 'host.name', 'service.name'),
|
||||
'kibana.observability.evaluation.value': {
|
||||
type: 'scaled_float' as const,
|
||||
scaling_factor: 1000,
|
||||
},
|
||||
'kibana.observability.evaluation.threshold': {
|
||||
type: 'scaled_float' as const,
|
||||
scaling_factor: 1000,
|
||||
},
|
||||
};
|
||||
|
||||
export type ObservabilityRuleFieldMap = typeof observabilityRuleFieldMap;
|
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export const observabilityRuleRegistrySettings = {
|
||||
name: 'observability',
|
||||
};
|
|
@ -24,6 +24,7 @@ import { usePluginContext } from '../../hooks/use_plugin_context';
|
|||
import { RouteParams } from '../../routes';
|
||||
import { callObservabilityApi } from '../../services/call_observability_api';
|
||||
import { getAbsoluteDateRange } from '../../utils/date';
|
||||
import { asDuration, asPercent } from '../../../common/utils/formatters';
|
||||
import { AlertsSearchBar } from './alerts_search_bar';
|
||||
import { AlertsTable } from './alerts_table';
|
||||
|
||||
|
@ -68,7 +69,7 @@ export function AlertsPage({ routeParams }: AlertsPageProps) {
|
|||
const formatted = {
|
||||
link: undefined,
|
||||
reason: alert['rule.name'],
|
||||
...(ruleType?.format?.({ alert }) ?? {}),
|
||||
...(ruleType?.format?.({ alert, formatters: { asDuration, asPercent } }) ?? {}),
|
||||
};
|
||||
|
||||
const parsedLink = formatted.link ? parse(formatted.link, true) : undefined;
|
||||
|
|
|
@ -5,32 +5,33 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import type { RuleRegistryPublicPluginSetupContract } from '../../rule_registry/public';
|
||||
import type {
|
||||
DataPublicPluginSetup,
|
||||
DataPublicPluginStart,
|
||||
} from '../../../../src/plugins/data/public';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import {
|
||||
AppMountParameters,
|
||||
AppUpdater,
|
||||
CoreSetup,
|
||||
CoreStart,
|
||||
DEFAULT_APP_CATEGORIES,
|
||||
Plugin as PluginClass,
|
||||
PluginInitializerContext,
|
||||
CoreStart,
|
||||
} from '../../../../src/core/public';
|
||||
import type {
|
||||
DataPublicPluginSetup,
|
||||
DataPublicPluginStart,
|
||||
} from '../../../../src/plugins/data/public';
|
||||
import type {
|
||||
HomePublicPluginSetup,
|
||||
HomePublicPluginStart,
|
||||
} from '../../../../src/plugins/home/public';
|
||||
import { registerDataHandler } from './data_handler';
|
||||
import { toggleOverviewLinkInNav } from './toggle_overview_link_in_nav';
|
||||
import type { LensPublicStart } from '../../lens/public';
|
||||
import { createCallObservabilityApi } from './services/call_observability_api';
|
||||
import { observabilityRuleRegistrySettings } from '../common/observability_rule_registry';
|
||||
import type { RuleRegistryPublicPluginSetupContract } from '../../rule_registry/public';
|
||||
import type { ObservabilityRuleFieldMap } from '../common/rules/observability_rule_field_map';
|
||||
import { observabilityRuleRegistrySettings } from '../common/rules/observability_rule_registry_settings';
|
||||
import { registerDataHandler } from './data_handler';
|
||||
import { FormatterRuleRegistry } from './rules/formatter_rule_registry';
|
||||
import { createCallObservabilityApi } from './services/call_observability_api';
|
||||
import { toggleOverviewLinkInNav } from './toggle_overview_link_in_nav';
|
||||
|
||||
export type ObservabilityPublicSetup = ReturnType<Plugin['setup']>;
|
||||
export type ObservabilityRuleRegistry = ObservabilityPublicSetup['ruleRegistry'];
|
||||
|
@ -72,6 +73,7 @@ export class Plugin
|
|||
|
||||
const observabilityRuleRegistry = pluginsSetup.ruleRegistry.registry.create({
|
||||
...observabilityRuleRegistrySettings,
|
||||
fieldMap: {} as ObservabilityRuleFieldMap,
|
||||
ctor: FormatterRuleRegistry,
|
||||
});
|
||||
|
||||
|
|
|
@ -7,12 +7,17 @@
|
|||
import type { RuleType } from '../../../rule_registry/public';
|
||||
import type { BaseRuleFieldMap, OutputOfFieldMap } from '../../../rule_registry/common';
|
||||
import { RuleRegistry } from '../../../rule_registry/public';
|
||||
import type { asDuration, asPercent } from '../../common/utils/formatters';
|
||||
|
||||
type AlertTypeOf<TFieldMap extends BaseRuleFieldMap> = OutputOfFieldMap<TFieldMap>;
|
||||
|
||||
type FormattableRuleType<TFieldMap extends BaseRuleFieldMap> = RuleType & {
|
||||
format?: (options: {
|
||||
alert: AlertTypeOf<TFieldMap>;
|
||||
formatters: {
|
||||
asDuration: typeof asDuration;
|
||||
asPercent: typeof asPercent;
|
||||
};
|
||||
}) => {
|
||||
reason?: string;
|
||||
link?: string;
|
||||
|
|
|
@ -16,7 +16,8 @@ import type { RuleRegistryPluginSetupContract } from '../../rule_registry/server
|
|||
import { uiSettings } from './ui_settings';
|
||||
import { registerRoutes } from './routes/register_routes';
|
||||
import { getGlobalObservabilityServerRouteRepository } from './routes/get_global_observability_server_route_repository';
|
||||
import { observabilityRuleRegistrySettings } from '../common/observability_rule_registry';
|
||||
import { observabilityRuleRegistrySettings } from '../common/rules/observability_rule_registry_settings';
|
||||
import { observabilityRuleFieldMap } from '../common/rules/observability_rule_field_map';
|
||||
|
||||
export type ObservabilityPluginSetup = ReturnType<ObservabilityPlugin['setup']>;
|
||||
export type ObservabilityRuleRegistry = ObservabilityPluginSetup['ruleRegistry'];
|
||||
|
@ -50,9 +51,10 @@ export class ObservabilityPlugin implements Plugin<ObservabilityPluginSetup> {
|
|||
});
|
||||
}
|
||||
|
||||
const observabilityRuleRegistry = plugins.ruleRegistry.create(
|
||||
observabilityRuleRegistrySettings
|
||||
);
|
||||
const observabilityRuleRegistry = plugins.ruleRegistry.create({
|
||||
...observabilityRuleRegistrySettings,
|
||||
fieldMap: observabilityRuleFieldMap,
|
||||
});
|
||||
|
||||
registerRoutes({
|
||||
core: {
|
||||
|
|
|
@ -11,8 +11,5 @@
|
|||
"triggersActionsUi"
|
||||
],
|
||||
"server": true,
|
||||
"ui": true,
|
||||
"extraPublicDirs": [
|
||||
"common"
|
||||
]
|
||||
"ui": true
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PluginInitializerContext } from 'kibana/public';
|
||||
import type { PluginInitializerContext } from 'kibana/public';
|
||||
import { Plugin } from './plugin';
|
||||
|
||||
export { RuleRegistryPublicPluginSetupContract } from './plugin';
|
||||
export type { RuleRegistryPublicPluginSetupContract } from './plugin';
|
||||
export { RuleRegistry } from './rule_registry';
|
||||
export type { IRuleRegistry, RuleType } from './rule_registry/types';
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import type {
|
|||
TriggersAndActionsUIPublicPluginSetup,
|
||||
TriggersAndActionsUIPublicPluginStart,
|
||||
} from '../../triggers_actions_ui/public';
|
||||
import { baseRuleFieldMap } from '../common';
|
||||
import type { BaseRuleFieldMap } from '../common';
|
||||
import { RuleRegistry } from './rule_registry';
|
||||
|
||||
interface RuleRegistrySetupPlugins {
|
||||
|
@ -40,7 +40,7 @@ export class Plugin
|
|||
|
||||
public setup(core: CoreSetup<RuleRegistryStartPlugins>, plugins: RuleRegistrySetupPlugins) {
|
||||
const rootRegistry = new RuleRegistry({
|
||||
fieldMap: baseRuleFieldMap,
|
||||
fieldMap: {} as BaseRuleFieldMap,
|
||||
alertTypeRegistry: plugins.triggersActionsUi.alertTypeRegistry,
|
||||
});
|
||||
return {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { AlertTypeRegistryContract } from '../../../triggers_actions_ui/public';
|
||||
import { BaseRuleFieldMap, FieldMap } from '../../common';
|
||||
import type { AlertTypeRegistryContract } from '../../../triggers_actions_ui/public';
|
||||
import type { BaseRuleFieldMap, FieldMap } from '../../common';
|
||||
|
||||
export interface RuleRegistryConstructorOptions<TFieldMap extends BaseRuleFieldMap> {
|
||||
fieldMap: TFieldMap;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue