Alert Management - end_time should be ingested by Alerts endpoint
The Alert endpoint should set ended_at when end_time exists in the Alert payload.
To reproduce
- Enable the generic alert endpoint (https://docs.gitlab.com/ee/user/project/integrations/generic_alerts.html)
- POST the following data to it:
{"title": "Simple Alert", "end_time": "2019-09-12T06:00:55Z"}- for example:
curl --request POST --data '{"title": "Simple Alert", "end_time": "2019-09-12T06:00:55Z"}' --header "Authorization: Bearer <bearer>" --header "Content-Type: application/json" <url>
- View the alert management list or check the model.
Expected Behaviour
- Ended At for the new alert should be '2019-09-12T06:00:55Z'
Actual Behaviour
- Ended At is
nil
More info:
"start_time" in the endpoint gets mapped to started_at in the model / graphql api. Presumably we want to follow the same naming convention for "end_time"/ended_at.
See our alert params definition - this is missing ended_at https://gitlab.com/gitlab-org/gitlab/-/blob/a11d61d1df52df434f006daf509dbda34d85e563/lib/gitlab/alert_management/alert_params.rb#L10
Edited by Tristan Read