Make `CreateAlertIssueService` independent from `CreateIssueService`
The following discussion from !31820 (merged) should be addressed:
-
@ck3g started a discussion: I was trying to reuse
IncidentManagement::CreateIssueService
as much as possible, to keep the MR smaller. But there are some problems withCreateIssueService.
First of all, it is coupled to the Prometheus alert structure, and it has a presentation logic build in. That's the reason why I apply this hack here to use payload parser here to convert generic alert payload to Prometheus format otherwise it will be "invalid".
I'm suggesting to create follow-up issues to improve that implementation. If we try to make these changes here, this MR will be significant in size and will take way more time.
We can incrementally introduce new changes in this class and make it responsible for creating an issue. To achieve that, we would need to introduce
AlertManagement::IssueAlertPresenter
, which will takeAlertManagement::Alert
object and provide methods to display alert's information in GitLab issue details.
Make Make AlertManagement::CreateAlertIssueService
independent from IncidentManagement::CreateIssueService
:
- Introduce
AlertManagement::IssueAlertPresenter
- Move logic related for creating an issue to
AlertManagement::CreateAlertIssueService
- Clean up
IncidentManagement::CreateIssueService
- Remove
skip_settings_check: false
- Remove
user = User.alert_bot
from constructor arguments
- Remove