Skip to content

Add prometheus_alert_id and environment_id to Alert management alerts

What does this MR do?

As part of #222253 (closed), we need a way for AlertManagement::Alert to relate to PrometheusAlerts and Environment.

Gitlab-managed Prometheus creates PrometheusAlerts. These are associated to environment and so we can access both the metric and environment by simply adding a prometheus_alert_id foreign key.

For self-managed Prometheus, there Prometheus Alert manager does not send us a GitLab PrometheusAlert ID as alerts are setup manually in their Prometheus instance by the user. However, we can still determine the environment by parsing the supplied gitlab_environment_name. For these, we add an environment_id foreign key.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Part of #222253 (closed)

Edited by Rémy Coutable

Merge request reports