Sync Prometheus updates from integrations table to http integrations
What does this MR do and why?
Mirrors updates to Integrations::Prometheus & Alerting::ProjectAlertingSetting records to corresponding AlertManagement::HttpIntegration. No user-facing changes are expected.
This is in preparation of preparation of splitting off the alert management portions of Integrations::Prometheus and removing Metrics Dashboard-related bits.
- Related issue: #338838 (closed)
- Related MRs:
How are prometheus integrations used after this MR? grouprespond
- Source of "Prometheus Integrations" in the UI/API:
Integrations::Prometheus/Alerting::ProjectAlertingSetting - Records impacted by CRUD operations:
Integrations::Prometheus/Alerting::ProjectAlertingSetting, synced toAlertManagement::HttpIntegrationsafter create/update - Authentication of incoming alerts:
AlertManagement::HttpIntegrations, fallback toIntegrations::Prometheus/Alerting::ProjectAlertingSettingif does not exist
How to set up and validate locally
There are no user-facing changes for this MR, but there are 4 decent regression tests:
- Trigger a test alert on an existing prometheus integration
- Re-enable an existing prometheus integration
- Update token for an existing prometheus integration
- Create a new prometheus integration (requires a new project or deleting the relevant records from the db)
Instructions
- On
master, create a prometheus integration- With maintainer+ permissions for a project, nav to
Settings > Monitor > Alerts - Select
Add new integration - Toggle the integration to
Active - Select
Save
- With maintainer+ permissions for a project, nav to
- Trigger a test alert for the integration to verify it's working as expected
- Nav to
Send test alerttab & enter a payload, and selectSend - Sample payload:
{ "version" : "4", "groupKey": null, "status": "firing", "receiver": "", "groupLabels": {}, "commonLabels": {}, "commonAnnotations": {}, "externalURL": "", "alerts": [{ "startsAt": "2023-07-28T11:22:40Z", "generatorURL": "http://host?g0.expr=up", "endsAt": null, "status": "firing", "labels": { "gitlab_environment_name": "production" }, "annotations": { "title": "Testing that prometheus alerts", } }] }
- Nav to
- Nav to
View credentialstab to selectReset keyto reset the token - Toggle
ActiveonConfigure detailstab to disable the integration
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Sarah Yasonik