Skip to content

Add service to generate metrics for deployment pipeline

Reuben Pereira requested to merge rp/add-new-duration-metrics2 into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Add a MetricsService class that can go through a deployment pipeline using the pipelines API, and update metrics recording the durations of jobs and pipelines.

This class works in a similar way to how traces are generated by PipelineTracer::Service. It retrieves information about the pipeline and its jobs using the pipelines and jobs APIs.

It uses the started_at and finished_at attributes to calculate the duration of the pipeline, and records it in a metric. We don't use the duration returned by the pipelines API since that value can be vastly different from the duration calculated using started_at and finished_at. This might be because jobs in a pipeline can be retried at any time, which can affect the duration of the pipeline. We want to measure the "wall-clock duration" of the pipeline.

For jobs, we record the duration returned by the jobs API. This duration is usually the same as the difference between finished_at and started_at.

gitlab-com/gl-infra/delivery#2891 (closed) and gitlab-com/gl-infra/delivery#2905 (closed)

Author Check-list

  • Has documentation been updated?
Edited by Reuben Pereira

Merge request reports