monitoring: configure alert notifications from site config
Created by: bobheadxi
closes #10641
This PR introduces a new workflow:
- admin goes to
site-admin/configuration
and adds:
"observability.alerts": [
{
"id": "email-notifier-1",
"level": "warning",
"notifier": {
"type": "email",
"addresses": "[email protected]"
}
},
{
"id": "email-notifier-2",
"level": "critical",
"notifier": {
"type": "email",
"addresses": "[email protected]"
}
},
{
"id": "email-notifier-3",
"level": "critical",
"notifier": {
"type": "email",
"addresses": "[email protected]"
}
}
]
- the
Overview
dashboard (duplicate of the home) is updated to fire alerts to the above channels whenx alerts by service
dashboard is >0
This is done by a new grafana-wrapper
that subscribes to site configuration updates and makes API calls to grafana to manipulate the alerts overview dashboard and notification channels.
TODO
-
what do if grafana doesn't accept new configuration? doesn't seem to be a straight-forward way to report the error back -> https://github.com/sourcegraph/sourcegraph/pull/11427#issuecomment-642987424 -
is firing on the overview dashboard the right thing to do? should we make a custom dashboard for this? -> https://github.com/sourcegraph/sourcegraph/pull/11427/files#r439128693 -
flesh out schema for grafana notifiers. rather tedious - grafana doesn't provide a json schema :( -> https://github.com/sourcegraph/sourcegraph/pull/11427#issuecomment-642985866