Only create issues if supposed to for Prometheus alerts
What does this MR do?
When we receive an alert notification from Prometheus, we should only create an issue if the project is configured to do so. This MR brings the logic for Prometheus alert processing in line with the logic for generic alerts.
Related issue: #236180 (closed)
Screenshots
Testing
-
Be a maintainer on a project
-
Toggle the 'Create an issue' setting under Settings > Operations > Incidents to control whether an issue should be created
-
Enable alerting for 'External prometheus' under Settings > Operations > Alerts (and save changes)
-
Trigger a test payload to prompt an alert to be created. Update the title & timestamp in this sample payload as-needed (alerts from prometheus are grouped by title & start time)
{
"version" : "4",
"groupKey": null,
"status": "firing",
"receiver": "",
"groupLabels": {},
"commonLabels": {},
"commonAnnotations": {},
"externalURL": "",
"alerts": [{
"startsAt": "2020-09-08T11:22:40Z",
"generatorURL": "http://host?g0.expr=up",
"endsAt": null,
"status": "firing",
"labels": {
"gitlab_environment_name": "production"
},
"annotations": {
"title": "Here is an alert",
"gitlab_y_label": "status"
}
}]
}
- See the alerts under Operations > Alerts to see the automatically created (or not) issues
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