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
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides - [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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)