Skip to content

Commit

Permalink
Configure observability rule URL for uptime rule types
Browse files Browse the repository at this point in the history
  • Loading branch information
maryam-saeidi committed Aug 7, 2023
1 parent 54f353b commit 02b6115
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -226,4 +228,6 @@ export const durationAnomalyAlertFactory: UptimeAlertTypeFactory<ActionGroupIds>
return { state: updateState(state, foundAnomalies) };
},
alerts: UptimeRuleTypeAlertDefinition,
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
observabilityPaths.ruleDetails(rule.id),
});
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -19,6 +20,7 @@ import {
AlertsLocatorParams,
formatDurationFromTimeUnitChar,
getAlertUrl,
observabilityPaths,
TimeUnitChar,
} from '@kbn/observability-plugin/common';
import { LocatorPublic } from '@kbn/share-plugin/common';
Expand Down Expand Up @@ -573,4 +575,6 @@ export const statusCheckAlertFactory: UptimeAlertTypeFactory<ActionGroupIds> = (
return { state: updateState(state, downMonitorsByLocation.length > 0) };
},
alerts: UptimeRuleTypeAlertDefinition,
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
observabilityPaths.ruleDetails(rule.id),
});
4 changes: 4 additions & 0 deletions x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
* 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';
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';
Expand Down Expand Up @@ -257,4 +259,6 @@ export const tlsAlertFactory: UptimeAlertTypeFactory<ActionGroupIds> = (
return { state: updateState(state, foundCerts) };
},
alerts: UptimeRuleTypeAlertDefinition,
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
observabilityPaths.ruleDetails(rule.id),
});
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -166,4 +167,6 @@ export const tlsLegacyAlertFactory: UptimeAlertTypeFactory<ActionGroupIds> = (_s

return { state: updateState(state, foundCerts) };
},
getViewInAppRelativeUrl: ({ rule }: GetViewInAppRelativeUrlFnOpts<{}>) =>
observabilityPaths.ruleDetails(rule.id),
});

0 comments on commit 02b6115

Please sign in to comment.