Skip to content

Draft: Another attempt at removing backslash in metric query

Jenny Kim requested to merge jennykim/fix-metric-query-2 into master

What does this MR do and why?

Followup to the original fix MR: !3167 (merged)

The query to fetch the metrics is still including a \, making it an incorrect thanos query. Take a look at this line https://ops.gitlab.net/gitlab-org/release/tools/-/jobs/14170028#L57

Received metric value from query -- {:query=>"last_over_time(delivery_release_monthly_status{version=\"17.1\"}[1h])", :value=>0}

Also, even though the logger.fatal was hit: F ReleaseTools::Prometheus::Query -- Returned metric value was 0 or non-existent. Check the query on Thanos., it still proceeded to set the status to value 3

I ReleaseTools::Metrics::MonthlyReleaseStatus -- Setting release_monthly_status metric -- {:status=>3, :labels=>"2024-06-20,17.1"}

So I added more return cases for when the status value gets returned as zero (invalid), and trying to get rid of the \ by using gsub. Let me know if there are more elegant approaches to this.

Feature flag for updating metrics is: release_status_metric_update

Addresses: gitlab-com/gl-infra/delivery#20181 (closed)

Merge request reports