Skip to content

Fix label interpolation in the status metric query

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

What does this MR do and why?

Attempt to fix the query to fetch the latest metric.

The query to fetch the latest release status metrics seemed to not process the "'s properly. Take a look at this line: https://ops.gitlab.net/gitlab-org/release/tools/-/jobs/14168112#L263

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

This is most likely due to

params = "version=\"#{version}\""
query = "last_over_time(delivery_release_monthly_status{#{params}}[1h])"

(code: https://gitlab.com/gitlab-org/release-tools/-/blob/946449ae8b91375ec3c33d62d8e625d38d7949b3/lib/release_tools/prometheus/query.rb#L66)

Not sure why it didn't interpolate the variable with the escaped " properly, but this is another way of interpolating the variable inside of strings without using "" to declare it, so let's give this a try.

Feature flag for updating metrics is: release_status_metric_update

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

Merge request reports