Skip to content

Use Time.now instead of finished_at if pipeline is still running

Reuben Pereira requested to merge rp/improve-pipeline-end-time into master

What does this MR do and why?

Describe in detail what your merge request does and why.

We currently generate traces using a job that runs in the same pipeline that it is generating traces for. This has the side-effect that the pipeline is still in running status when traces are being generated.

When pipeline is in running status, the finished_at value might be set, but it could be from the last time the pipeline was in a failed/canceled/manual state.

updated_at is only updated when the entry in database is updated, for example when the pipeline status changes.

So both finished_at and updated_at can contain quite old values.

If the pipeline is still running, we can use Time.now as the timestamp for when the pipeline completed. This is not perfect, but it should give more accurate values than currently.

This workaround will not be required once we start running the tracing job in a separate pipeline (!2232).

Author Check-list

  • Has documentation been updated?
Edited by Reuben Pereira

Merge request reports