Skip to content

Add optional project labels to keep-around ref metrics

James Fargher requested to merge label_keep_around_ref_metrics into master

What does this MR do and why?

#383814

We cannot unconditionally add project labels to prometheus metrics, but there are specific projects that are useful to track like gitlab-org/gitlab. So here we add a feature flag so that these projects can be conditionally labelled.

Changelog: changed

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. Create a new merge request, add a review comment.
  2. Check in http://127.0.0.1:3000/-/metrics for gitlab_keeparound_refs_created_total and gitlab_keeparound_refs_requested_total. Note that a lot of keep-around refs are created in sidekiq and so will no appear here. This only shows keep-around metrics created in web.
  3. Enable the feature for the specific project:
    Feature.enable(:label_keep_around_ref_metrics, Project.find(1))
  4. Repeat steps 1 and 2 for this project. Check that full_path is populated:
    # HELP gitlab_keeparound_refs_created_total Multiprocess metric
    # TYPE gitlab_keeparound_refs_created_total counter
    gitlab_keeparound_refs_created_total{full_path="",source="MergeRequestDiff"} 1
    gitlab_keeparound_refs_created_total{full_path="root/banana",source="MergeRequestDiff"} 1
Edited by James Fargher

Merge request reports