-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve getting/updating contact points for Grafana Alerting integrat…
…ion (#2742) This PR improves Grafana Alerting integration: - get alerting contact points "on fly" instead of keeping them in db - add ability to connect more than one contact point - add ability to create new contact point on create Grafana Alerting integration - show warnings in integration settings for non-active contact points - remove creation alerting notification policies on create Grafana Alerting integration ## Checklist - [x] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --------- Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
- Loading branch information
Showing
30 changed files
with
2,700 additions
and
895 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .grafana_alerting_sync import GrafanaAlertingSyncManager # noqa: F401 |
889 changes: 410 additions & 479 deletions
889
engine/apps/alerts/grafana_alerting_sync_manager/grafana_alerting_sync.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 7 additions & 3 deletions
10
engine/apps/alerts/tasks/sync_grafana_alerting_contact_points.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
from apps.alerts.grafana_alerting_sync_manager.grafana_alerting_sync import GrafanaAlertingSyncManager | ||
from common.custom_celery_tasks import shared_dedicated_queue_retry_task | ||
|
||
|
||
# deprecated | ||
@shared_dedicated_queue_retry_task(autoretry_for=(Exception,), retry_backoff=True, max_retries=10) | ||
def sync_grafana_alerting_contact_points(alert_receive_channel_id): | ||
pass | ||
|
||
|
||
@shared_dedicated_queue_retry_task(autoretry_for=(Exception,), retry_backoff=True, max_retries=10) | ||
def disconnect_integration_from_alerting_contact_points(alert_receive_channel_id): | ||
from apps.alerts.models import AlertReceiveChannel | ||
|
||
alert_receive_channel = AlertReceiveChannel.objects_with_deleted.get(pk=alert_receive_channel_id) | ||
|
||
GrafanaAlertingSyncManager(alert_receive_channel).sync_each_contact_point() | ||
alert_receive_channel.grafana_alerting_sync_manager.disconnect_all_contact_points() |
Oops, something went wrong.