Skip to content
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

Add alertmanager integration for heartbeat support #2807

Merged
merged 4 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix issue with updating "Require resolution note" setting by @Ferril ([#2782](https://github.com/grafana/oncall/pull/2782))
- Don't send notifications about past SSRs when turning on info notifications by @vadimkerr ([#2783](https://github.com/grafana/oncall/pull/2783))
- Add schedule shift type validation on create/preview ([#2789](https://github.com/grafana/oncall/pull/2789))
- Add alertmanager integration for heartbeat support ([2807](https://github.com/grafana/oncall/pull/2807))

## v1.3.23 (2023-08-10)

Expand Down
14 changes: 14 additions & 0 deletions engine/apps/alerts/tests/test_alert_receiver_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,17 @@ def test_get_or_create_manual_integration_deleted_team(make_organization, make_t
organization=organization, team=None, integration=AlertReceiveChannel.INTEGRATION_MANUAL, defaults={}
)
assert integration == general_manual


@pytest.mark.django_db
@pytest.mark.parametrize(
"integration",
[
AlertReceiveChannel.INTEGRATION_LEGACY_ALERTMANAGER,
AlertReceiveChannel.INTEGRATION_ALERTMANAGER,
],
)
def test_alertmanager_available_for_heartbeat(make_organization, make_alert_receive_channel, integration):
organization = make_organization()
alert_receive_channel = make_alert_receive_channel(organization, integration=integration)
assert alert_receive_channel.is_available_for_integration_heartbeat
1 change: 1 addition & 0 deletions engine/apps/integrations/metadata/heartbeat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Filename MUST match INTEGRATION_TO_REVERSE_URL_MAP.
"""

import apps.integrations.metadata.heartbeat.alertmanager # noqa
import apps.integrations.metadata.heartbeat.elastalert # noqa
import apps.integrations.metadata.heartbeat.formatted_webhook # noqa
import apps.integrations.metadata.heartbeat.grafana # noqa
Expand Down
12 changes: 9 additions & 3 deletions engine/apps/integrations/metadata/heartbeat/alertmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
"numResolved": 0,
"commonLabels": {"alertname": "OnCallHeartBeatMissing"},
"truncatedAlerts": 0,
"commonAnnotations": {},
"commonAnnotations": {
"title": heartbeat_expired_title,
"description": heartbeat_expired_message,
},
}

heartbeat_restored_title = heartbeat_text.heartbeat_restored_title
Expand All @@ -61,7 +64,7 @@
"generatorURL": "",
},
],
"status": "firing",
"status": "resolved",
"version": "4",
"groupKey": '{}:{alertname="OnCallHeartBeatMissing"}',
"receiver": "",
Expand All @@ -71,5 +74,8 @@
"numResolved": 1,
"commonLabels": {"alertname": "OnCallHeartBeatMissing"},
"truncatedAlerts": 0,
"commonAnnotations": {},
"commonAnnotations": {
"title": heartbeat_restored_title,
"description": heartbeat_restored_message,
},
}
Loading