oncall-engine/engine/apps/integrations/metadata/heartbeat/legacy_alertmanager.py
Innokentii Konstantinov 1ccb9d6979
AlertManager v2 (#2643)
Introduce AlertManager v2 integration with improved internal behaviour

it's using grouping from AlertManager, not trying to re-group alerts on
OnCall side.
Existing AlertManager and Grafana Alerting integrations are marked as
Legacy with options to migrate them manually now or be migrated
automatically after DEPRECATION DATE(TBD).
Integration urls and public api responses stay the same both for legacy
and new integrations.

---------

Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-08-01 12:18:52 +08:00

33 lines
1 KiB
Python

from pathlib import PurePath
from apps.integrations.metadata.heartbeat._heartbeat_text_creator import HeartBeatTextCreatorForTitleGrouping
integration_verbal = PurePath(__file__).stem
creator = HeartBeatTextCreatorForTitleGrouping(integration_verbal)
heartbeat_text = creator.get_heartbeat_texts()
heartbeat_expired_title = heartbeat_text.heartbeat_expired_title
heartbeat_expired_message = heartbeat_text.heartbeat_expired_message
heartbeat_expired_payload = {
"endsAt": "",
"labels": {"alertname": heartbeat_expired_title},
"status": "firing",
"startsAt": "",
"annotations": {
"message": heartbeat_expired_message,
},
"generatorURL": None,
}
heartbeat_restored_title = heartbeat_text.heartbeat_restored_title
heartbeat_restored_message = heartbeat_text.heartbeat_restored_message
heartbeat_restored_payload = {
"endsAt": "",
"labels": {"alertname": heartbeat_restored_title},
"status": "resolved",
"startsAt": "",
"annotations": {"message": heartbeat_restored_message},
"generatorURL": None,
}