Fix Git.version metric value generated causes bug in Version app
requested to merge 359925-git-version-metric-value-generated-inconsistently-which-causes-bug-in-version-app into master
What does this MR do and why?
This MR adds to_json
method to VersionInfo
. This fixes the bug when git.version
metric (from ServicePing) being incorrectly represented using method to_s
when payload is generated.
[16] pry(main)> payload = Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values)
[17] pry(main)> payload[:git].to_json
=> "{\"version\":{\"major\":2,\"minor\":35,\"patch\":1}}"
[18] pry(main)> Gitlab::Json.pretty_generate(payload[:git])
=> "{\n \"version\": \"2.35.1\"\n}"
How to set up and validate locally
pry(main)> payload = Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values)
pry(main)> Gitlab::Json.pretty_generate(payload[:git])
=> "{\"version\":{\"major\":2,\"minor\":35,\"patch\":1}}"
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #359925 (closed)
Edited by Niko Belokolodov