Skip to content

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

  1. Enable the generic alert endpoint (https://docs.gitlab.com/ee/user/project/integrations/generic_alerts.html)
  2. 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>
  1. View the alert management list or check the model.

Expected Behaviour

  1. Ended At for the new alert should be '2019-09-12T06:00:55Z'

Actual Behaviour

  1. 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