Skip to content

Sync Prometheus updates from integrations table to http integrations

Sarah Yasonik requested to merge sy-manage-prometheus-type-integrations into master

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.

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 to AlertManagement::HttpIntegrations after create/update
  • Authentication of incoming alerts: AlertManagement::HttpIntegrations, fallback to Integrations::Prometheus/Alerting::ProjectAlertingSetting if 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:

  1. Trigger a test alert on an existing prometheus integration
  2. Re-enable an existing prometheus integration
  3. Update token for an existing prometheus integration
  4. Create a new prometheus integration (requires a new project or deleting the relevant records from the db)
Instructions
  1. 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
  2. Trigger a test alert for the integration to verify it's working as expected
    • Nav to Send test alert tab & enter a payload, and select Send
    • 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",
          }
        }]
      }
  3. Nav to View credentials tab to select Reset key to reset the token
  4. Toggle Active on Configure details tab 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.

Edited by Sarah Yasonik

Merge request reports