-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Uptime] migrate to observability rules registry #100699
[Uptime] migrate to observability rules registry #100699
Conversation
…-uptime-migrate-to-observability-rules-registry
Pinging @elastic/uptime (Team:uptime) |
@@ -37,3 +37,60 @@ export const MonitorStatusTranslations = { | |||
defaultMessage: 'Alert when a monitor is down or an availability threshold is breached.', | |||
}), | |||
}; | |||
|
|||
export const TlsTranslations = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved alert translations to common, in order to use them within server to derive reason message.
@@ -30,4 +32,8 @@ export const initDurationAnomalyAlertType: AlertTypeInitializer = ({ | |||
validate: () => ({ errors: {} }), | |||
defaultActionMessage, | |||
requiresAppContext: true, | |||
format: ({ alert }) => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
draft.
@@ -27,7 +27,7 @@ export const SettingsMessageExpressionPopover: React.FC<SettingsMessageExpressio | |||
id, | |||
}) => { | |||
const kibana = useKibana(); | |||
const path = kibana.services?.application?.getUrlForApp('uptime', { path: 'settings' }); | |||
const settingsPath = kibana.services?.http?.basePath.prepend('uptime/settings'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because alerts are registered in the setup
function, this component no longer has access to getUrlForApp.
type: 'keyword', | ||
}, | ||
// tls alert fields | ||
'cert.count': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shahzad31 We can't use the ecs fields here, since the fields represent a single instance of a cert, but these are meant to represent all the found expiring/aging certs to the entire alert. (Also this is supposed to be cert_status.count
, like the rest of the items below).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ that makes senese
@elasticmachine merge upstream |
…ity-rules-registry
…istry' of https://github.com/dominiqueclarke/kibana into feature/98382-uptime-migrate-to-observability-rules-registry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good can see the alerts and code looks good as well. !!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, tested this out with a few basic alerts and didn't see any red flags.
const { anomalies } = | ||
(await getAnomalies(plugins, savedObjectsClient, params, state.lastCheckedAt)) ?? {}; | ||
if (foundAnomalies) { | ||
const monitorInfo = await libs.requests.getLatestMonitor({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if there was a particular reason we were doing it as a direct import. Given that we are supplying all the dependencies in either case, I think it doesn't hurt to use the libs
version.
@elasticmachine merge upstream |
…ity-rules-registry
…-uptime-migrate-to-observability-rules-registry
…istry' of https://github.com/dominiqueclarke/kibana into feature/98382-uptime-migrate-to-observability-rules-registry
…ity-rules-registry
💚 Build SucceededMetrics [docs]Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this again with some more alerts. LGTM
* uptime - migrate to observability rules registry * Modify Uptime alert types to work with server rule registry. * Export `RuleType` type for consumption by client plugins. * Add platinum as an option for `minimumLicenseRequired` field of `RuleTypeBase`. * Simplify alert bootstrapping, inherit `RuleType` for alert factories. * update rule field map * adjust rule registery to be created within setup instead of mount * adjust plugin setup to account for rule registry changes * export types from rule registry * move alert action message translations to common * update rule field map * update monitor status public alert model * update tls public alert model * update monitor status alert server model * update tls alert sever model * update server plugin file to scope alerts indices to synthetics * add initContext to server Plugin class * adjust public plugin to register alerts when core start is availabile * update mappings * update asset names * adjust dependencies for alert initialization * adjust duration anomaly server alert model * adjust duration anomaly and monitor status public alert model to account for undefined types * add duration_anomaly tests * add anomaly severity * adjust types * update uptime server plugin * remove test_helpers * add getMonitorRouteFromMonitorId helper * export AlertTypeWithExecutor from rule_registry * adjust types * mock time zone * update types * update types for legacy tls alert * update mappings * update monitor status check tls types * update tls types and indexed fields * update duration anomaly types and indexed fields * update mappings * delete unnecessary file * adjust types * adjust ruleDataClient initialization * index anomaly bucket span * update types * adjust registration of legacy tls alert type * adjust types * update index alias name * update anomaly detection rule mappings * adjust import for certificate alert * adjust rbac settings * adjust content * adjust uptime server plugin Co-authored-by: Justin Kambic <justin.kambic@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* uptime - migrate to observability rules registry * Modify Uptime alert types to work with server rule registry. * Export `RuleType` type for consumption by client plugins. * Add platinum as an option for `minimumLicenseRequired` field of `RuleTypeBase`. * Simplify alert bootstrapping, inherit `RuleType` for alert factories. * update rule field map * adjust rule registery to be created within setup instead of mount * adjust plugin setup to account for rule registry changes * export types from rule registry * move alert action message translations to common * update rule field map * update monitor status public alert model * update tls public alert model * update monitor status alert server model * update tls alert sever model * update server plugin file to scope alerts indices to synthetics * add initContext to server Plugin class * adjust public plugin to register alerts when core start is availabile * update mappings * update asset names * adjust dependencies for alert initialization * adjust duration anomaly server alert model * adjust duration anomaly and monitor status public alert model to account for undefined types * add duration_anomaly tests * add anomaly severity * adjust types * update uptime server plugin * remove test_helpers * add getMonitorRouteFromMonitorId helper * export AlertTypeWithExecutor from rule_registry * adjust types * mock time zone * update types * update types for legacy tls alert * update mappings * update monitor status check tls types * update tls types and indexed fields * update duration anomaly types and indexed fields * update mappings * delete unnecessary file * adjust types * adjust ruleDataClient initialization * index anomaly bucket span * update types * adjust registration of legacy tls alert type * adjust types * update index alias name * update anomaly detection rule mappings * adjust import for certificate alert * adjust rbac settings * adjust content * adjust uptime server plugin Co-authored-by: Justin Kambic <justin.kambic@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Dominique Clarke <doclarke71@gmail.com> Co-authored-by: Justin Kambic <justin.kambic@elastic.co>
Fixes #98382
This PR registers uptime alerts in the new rules registry by taking the following steps.
plugin.ts
plugin.ts
alertWithLifecycle
service passing along with relevant fields to populate our alerts in the Observability alerts tablereason
andlink
field to integrate with the Observability alerts table UI.Author Checklist
note: This feature is purely technical in nature, and does not directly touch UI elements that need accessibility considerations.
Telemetry has been added where relevant@justinkambic @shahzad31 Do we currently have telemetry in place for alerts?Docs have been added to this PR covering any new, changed, or removed featuresReviewer Checklist
Testing
kibana.dev.yaml keys
[ ] - Ensure that rules appear on the Observability alerts table found at
/app/observability/alerts
[ ] - Ensure that reason is configured correctly in the Observability alerts table
[ ] - Ensure that
View in App
from the Observability alerts table takes you to the correct context in Uptime[ ] - Smoke test that action connectors are appropriately sending alert messages
[ ] - Smoke test that the rules are appearing appropriately in the rules and connectors page.
Edge case
[ ] - Smoke test that the legacy Uptime TLS rule still works as expected, by configuring it from the Rules and Connectors page, which is the only place it should be accessible. Ensure that this rule does not appear in the Observability alerts table