Skip to content

Change average job duration panel to median job duration

Reuben Pereira requested to merge rp/median-job-duration into master

Change average job duration panel to median job duration. And display the max in the same panel.

This is the query I used for the "Median job duration" panel, along with the reasoning behind each part.

quantile(0.5,
            // Every value of this metric is a new time series, and we need a way to get all the values of this metric over the 
            // selected time range.
            // I used last_over_time to do this.
            last_over_time(delivery_deployment_job_duration_seconds{job_name="$job_name"}[$__range])

              // `A unless B` removes any time series from A if it is present in B. This effectively allows us to choose time
              // series that appeared only in the selected time range, and exclude any time series that was also present
              // before the selected time range.
              // I used `unless` and `offset` to exclude any metric values that are also present before the selected time range.
              // For the time range, I chose 12 hours just to collect metrics over a large enough time range. This does not need
              // to be the same as $__range since we just want to know which metrics were present before the selected time range.
              // Maybe 1h would be good enough as well. 
              unless
            last_over_time(delivery_deployment_job_duration_seconds{job_name="$job_name"}[12h] offset $__range)
          )

https://dashboards.gitlab.net/dashboard/snapshot/PripC08OvFtRADcasiZ2HGLh50s1610S?orgId=1

image

Edited by Reuben Pereira

Merge request reports