mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Configure "View rule in Kibana" Url for Observability rule types (#163292)
Closes #163168
## Summary
This PR configures the "View rule in Kibana" URL to point to the
observability rule details for observability rule types.

This commit is contained in:
parent
5e49bfd9fc
commit
feb249314b
17 changed files with 80 additions and 11 deletions
|
@ -4,11 +4,17 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { GetViewInAppRelativeUrlFnOpts } from '@kbn/alerting-plugin/server';
|
||||
import { KibanaRequest } from '@kbn/core/server';
|
||||
import datemath from '@kbn/datemath';
|
||||
import type { ESSearchResponse } from '@kbn/es-types';
|
||||
import { getAlertUrl, ProcessorEvent } from '@kbn/observability-plugin/common';
|
||||
import {
|
||||
getAlertUrl,
|
||||
observabilityPaths,
|
||||
ProcessorEvent,
|
||||
} from '@kbn/observability-plugin/common';
|
||||
import { termQuery } from '@kbn/observability-plugin/server';
|
||||
import {
|
||||
ALERT_EVALUATION_THRESHOLD,
|
||||
|
@ -329,6 +335,8 @@ export function registerAnomalyRuleType({
|
|||
return { state: {} };
|
||||
},
|
||||
alerts: ApmRuleTypeAlertDefinition,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { GetViewInAppRelativeUrlFnOpts } from '@kbn/alerting-plugin/server';
|
||||
import {
|
||||
formatDurationFromTimeUnitChar,
|
||||
getAlertUrl,
|
||||
observabilityPaths,
|
||||
ProcessorEvent,
|
||||
TimeUnitChar,
|
||||
} from '@kbn/observability-plugin/common';
|
||||
|
@ -254,6 +256,8 @@ export function registerErrorCountRuleType({
|
|||
return { state: {} };
|
||||
},
|
||||
alerts: ApmRuleTypeAlertDefinition,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -6,10 +6,12 @@
|
|||
*/
|
||||
|
||||
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { GetViewInAppRelativeUrlFnOpts } from '@kbn/alerting-plugin/server';
|
||||
import {
|
||||
asDuration,
|
||||
formatDurationFromTimeUnitChar,
|
||||
getAlertDetailsUrl,
|
||||
observabilityPaths,
|
||||
ProcessorEvent,
|
||||
TimeUnitChar,
|
||||
} from '@kbn/observability-plugin/common';
|
||||
|
@ -298,6 +300,8 @@ export function registerTransactionDurationRuleType({
|
|||
return { state: {} };
|
||||
},
|
||||
alerts: ApmRuleTypeAlertDefinition,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
});
|
||||
|
||||
alerting.registerType(ruleType);
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { GetViewInAppRelativeUrlFnOpts } from '@kbn/alerting-plugin/server';
|
||||
import {
|
||||
formatDurationFromTimeUnitChar,
|
||||
getAlertUrl,
|
||||
observabilityPaths,
|
||||
ProcessorEvent,
|
||||
TimeUnitChar,
|
||||
} from '@kbn/observability-plugin/common';
|
||||
|
@ -306,6 +308,8 @@ export function registerTransactionErrorRateRuleType({
|
|||
return { state: {} };
|
||||
},
|
||||
alerts: ApmRuleTypeAlertDefinition,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
import { schema, Type } from '@kbn/config-schema';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { PluginSetupContract } from '@kbn/alerting-plugin/server';
|
||||
import { GetViewInAppRelativeUrlFnOpts, PluginSetupContract } from '@kbn/alerting-plugin/server';
|
||||
import { observabilityPaths } from '@kbn/observability-plugin/common';
|
||||
import { TimeUnitChar } from '@kbn/observability-plugin/common/utils/formatters/duration';
|
||||
import {
|
||||
Comparator,
|
||||
|
@ -147,5 +148,7 @@ export async function registerMetricInventoryThresholdRuleType(
|
|||
},
|
||||
alerts: MetricsRulesTypeAlertDefinition,
|
||||
fieldsForAAD: O11Y_AAD_FIELDS,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { PluginSetupContract } from '@kbn/alerting-plugin/server';
|
||||
import { GetViewInAppRelativeUrlFnOpts, PluginSetupContract } from '@kbn/alerting-plugin/server';
|
||||
import { observabilityPaths } from '@kbn/observability-plugin/common';
|
||||
import { O11Y_AAD_FIELDS } from '../../../../common/constants';
|
||||
import { createLogThresholdExecutor, FIRED_ACTIONS } from './log_threshold_executor';
|
||||
import { extractReferences, injectReferences } from './log_threshold_references_manager';
|
||||
|
@ -166,5 +167,7 @@ export async function registerLogThresholdRuleType(
|
|||
},
|
||||
alerts: LogsRulesTypeAlertDefinition,
|
||||
fieldsForAAD: O11Y_AAD_FIELDS,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,8 +12,10 @@ import {
|
|||
RuleType,
|
||||
AlertInstanceState as AlertState,
|
||||
AlertInstanceContext as AlertContext,
|
||||
GetViewInAppRelativeUrlFnOpts,
|
||||
} from '@kbn/alerting-plugin/server';
|
||||
import { RecoveredActionGroupId } from '@kbn/alerting-plugin/common';
|
||||
import { observabilityPaths } from '@kbn/observability-plugin/common';
|
||||
import { O11Y_AAD_FIELDS } from '../../../../common/constants';
|
||||
import {
|
||||
createMetricAnomalyExecutor,
|
||||
|
@ -116,4 +118,6 @@ export const registerMetricAnomalyRuleType = (
|
|||
},
|
||||
],
|
||||
},
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
});
|
||||
|
|
|
@ -8,7 +8,12 @@
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ActionGroupIdsOf } from '@kbn/alerting-plugin/common';
|
||||
import { PluginSetupContract, RuleType } from '@kbn/alerting-plugin/server';
|
||||
import {
|
||||
GetViewInAppRelativeUrlFnOpts,
|
||||
PluginSetupContract,
|
||||
RuleType,
|
||||
} from '@kbn/alerting-plugin/server';
|
||||
import { observabilityPaths } from '@kbn/observability-plugin/common';
|
||||
import { Comparator, METRIC_THRESHOLD_ALERT_TYPE_ID } from '../../../../common/alerting/metrics';
|
||||
import { METRIC_EXPLORER_AGGREGATIONS } from '../../../../common/http_api';
|
||||
import { InfraBackendLibs } from '../../infra_types';
|
||||
|
@ -185,5 +190,7 @@ export async function registerMetricThresholdRuleType(
|
|||
},
|
||||
producer: 'infrastructure',
|
||||
alerts: MetricsRulesTypeAlertDefinition,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -67,4 +67,6 @@ export const rulesLocatorID = 'RULES_LOCATOR';
|
|||
export const sloDetailsLocatorID = 'SLO_DETAILS_LOCATOR';
|
||||
export const sloEditLocatorID = 'SLO_EDIT_LOCATOR';
|
||||
|
||||
import { paths } from './locators/paths';
|
||||
export const observabilityPaths = paths.observability;
|
||||
export type { AlertsLocatorParams } from './locators/alerts';
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { GetViewInAppRelativeUrlFnOpts } from '@kbn/alerting-plugin/server';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { LicenseType } from '@kbn/licensing-plugin/server';
|
||||
|
@ -12,7 +13,7 @@ import { createLifecycleExecutor } from '@kbn/rule-registry-plugin/server';
|
|||
import { legacyExperimentalFieldMap } from '@kbn/alerts-as-data-utils';
|
||||
import { IBasePath } from '@kbn/core/server';
|
||||
import { LocatorPublic } from '@kbn/share-plugin/common';
|
||||
import { AlertsLocatorParams, sloFeatureId } from '../../../../common';
|
||||
import { AlertsLocatorParams, observabilityPaths, sloFeatureId } from '../../../../common';
|
||||
import { SLO_RULE_REGISTRATION_CONTEXT } from '../../../common/constants';
|
||||
|
||||
import {
|
||||
|
@ -85,6 +86,8 @@ export function sloBurnRateRuleType(
|
|||
useEcs: false,
|
||||
useLegacyAlerts: true,
|
||||
},
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,11 @@ import { createLifecycleExecutor, IRuleDataClient } from '@kbn/rule-registry-plu
|
|||
import { LicenseType } from '@kbn/licensing-plugin/server';
|
||||
import { LocatorPublic } from '@kbn/share-plugin/common';
|
||||
import { EsQueryRuleParamsExtractedParams } from '@kbn/stack-alerts-plugin/server/rule_types/es_query/rule_type_params';
|
||||
import { paths } from '../../../../common/locators/paths';
|
||||
import { AlertsLocatorParams, observabilityFeatureId } from '../../../../common';
|
||||
import {
|
||||
AlertsLocatorParams,
|
||||
observabilityFeatureId,
|
||||
observabilityPaths,
|
||||
} from '../../../../common';
|
||||
import { Comparator } from '../../../../common/threshold_rule/types';
|
||||
import { OBSERVABILITY_THRESHOLD_RULE_TYPE_ID } from '../../../../common/constants';
|
||||
import { THRESHOLD_RULE_REGISTRATION_CONTEXT } from '../../../common/constants';
|
||||
|
@ -181,8 +184,7 @@ export function thresholdRuleType(
|
|||
},
|
||||
producer: observabilityFeatureId,
|
||||
alerts: MetricsRulesTypeAlertDefinition,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) => {
|
||||
return paths.observability.ruleDetails(rule.id);
|
||||
},
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,8 +4,11 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { isEmpty } from 'lodash';
|
||||
import { ActionGroupIdsOf } from '@kbn/alerting-plugin/common';
|
||||
import { GetViewInAppRelativeUrlFnOpts } from '@kbn/alerting-plugin/server';
|
||||
import { observabilityPaths } from '@kbn/observability-plugin/common';
|
||||
import { createLifecycleRuleTypeFactory, IRuleDataClient } from '@kbn/rule-registry-plugin/server';
|
||||
import { SyntheticsPluginsSetupDependencies, SyntheticsServerSetup } from '../../types';
|
||||
import { DOWN_LABEL, getMonitorAlertDocument, getMonitorSummary } from './message_utils';
|
||||
|
@ -155,5 +158,7 @@ export const registerSyntheticsStatusCheckRule = (
|
|||
};
|
||||
},
|
||||
alerts: UptimeRuleTypeAlertDefinition,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
});
|
||||
};
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ActionGroupIdsOf } from '@kbn/alerting-plugin/common';
|
||||
import { GetViewInAppRelativeUrlFnOpts } from '@kbn/alerting-plugin/server';
|
||||
import { createLifecycleRuleTypeFactory, IRuleDataClient } from '@kbn/rule-registry-plugin/server';
|
||||
import { asyncForEach } from '@kbn/std';
|
||||
import { ALERT_REASON, ALERT_UUID } from '@kbn/rule-data-utils';
|
||||
|
@ -12,6 +14,7 @@ import {
|
|||
alertsLocatorID,
|
||||
AlertsLocatorParams,
|
||||
getAlertUrl,
|
||||
observabilityPaths,
|
||||
} from '@kbn/observability-plugin/common';
|
||||
import { LocatorPublic } from '@kbn/share-plugin/common';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
@ -148,5 +151,7 @@ export const registerSyntheticsTLSCheckRule = (
|
|||
return { state: updateState(ruleState, foundCerts) };
|
||||
},
|
||||
alerts: UptimeRuleTypeAlertDefinition,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
});
|
||||
};
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { GetViewInAppRelativeUrlFnOpts } from '@kbn/alerting-plugin/server';
|
||||
import moment from 'moment';
|
||||
import { KibanaRequest, SavedObjectsClientContract } from '@kbn/core/server';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
@ -19,6 +20,7 @@ import {
|
|||
alertsLocatorID,
|
||||
AlertsLocatorParams,
|
||||
getAlertUrl,
|
||||
observabilityPaths,
|
||||
} from '@kbn/observability-plugin/common';
|
||||
import { LocatorPublic } from '@kbn/share-plugin/common';
|
||||
import { asyncForEach } from '@kbn/std';
|
||||
|
@ -226,4 +228,6 @@ export const durationAnomalyAlertFactory: UptimeAlertTypeFactory<ActionGroupIds>
|
|||
return { state: updateState(state, foundAnomalies) };
|
||||
},
|
||||
alerts: UptimeRuleTypeAlertDefinition,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
});
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { GetViewInAppRelativeUrlFnOpts } from '@kbn/alerting-plugin/server';
|
||||
import { min } from 'lodash';
|
||||
import moment from 'moment';
|
||||
|
||||
|
@ -19,6 +20,7 @@ import {
|
|||
AlertsLocatorParams,
|
||||
formatDurationFromTimeUnitChar,
|
||||
getAlertUrl,
|
||||
observabilityPaths,
|
||||
TimeUnitChar,
|
||||
} from '@kbn/observability-plugin/common';
|
||||
import { LocatorPublic } from '@kbn/share-plugin/common';
|
||||
|
@ -572,4 +574,6 @@ export const statusCheckAlertFactory: UptimeAlertTypeFactory<ActionGroupIds> = (
|
|||
return { state: updateState(state, downMonitorsByLocation.length > 0) };
|
||||
},
|
||||
alerts: UptimeRuleTypeAlertDefinition,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { GetViewInAppRelativeUrlFnOpts } from '@kbn/alerting-plugin/server';
|
||||
import moment from 'moment';
|
||||
import { ActionGroupIdsOf } from '@kbn/alerting-plugin/common';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
@ -12,6 +13,7 @@ import {
|
|||
alertsLocatorID,
|
||||
AlertsLocatorParams,
|
||||
getAlertUrl,
|
||||
observabilityPaths,
|
||||
} from '@kbn/observability-plugin/common';
|
||||
import { LocatorPublic } from '@kbn/share-plugin/common';
|
||||
import { ALERT_REASON, ALERT_UUID } from '@kbn/rule-data-utils';
|
||||
|
@ -257,4 +259,6 @@ export const tlsAlertFactory: UptimeAlertTypeFactory<ActionGroupIds> = (
|
|||
return { state: updateState(state, foundCerts) };
|
||||
},
|
||||
alerts: UptimeRuleTypeAlertDefinition,
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
});
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { observabilityPaths } from '@kbn/observability-plugin/common';
|
||||
import moment from 'moment';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { ActionGroupIdsOf } from '@kbn/alerting-plugin/common';
|
||||
import { AlertInstanceContext } from '@kbn/alerting-plugin/common';
|
||||
import { Alert } from '@kbn/alerting-plugin/server';
|
||||
import { Alert, GetViewInAppRelativeUrlFnOpts } from '@kbn/alerting-plugin/server';
|
||||
import { UptimeAlertTypeFactory } from './types';
|
||||
import { updateState } from './common';
|
||||
import { CLIENT_ALERT_TYPES, TLS_LEGACY } from '../../../../common/constants/uptime_alerts';
|
||||
|
@ -166,4 +167,6 @@ export const tlsLegacyAlertFactory: UptimeAlertTypeFactory<ActionGroupIds> = (_s
|
|||
|
||||
return { state: updateState(state, foundCerts) };
|
||||
},
|
||||
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
|
||||
observabilityPaths.ruleDetails(rule.id),
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue