Git.version metric value generated inconsistently which causes bug in Version app
Summary
Steps to reproduce
[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}"
git.version
metric can be a string or an object, depending on the way ServicePing was generated.
Generated using SubmitService https://gitlab.com/gitlab-org/gitlab/blob/master/app/services/service_ping/submit_service.rb#L66
Generated using Pretty json https://gitlab.com/gitlab-org/gitlab/blob/master/lib/tasks/gitlab/usage_data.rake#L12
Version app cannot properly parse the metric with string value, raises NoMethod: fetch for string
exception.
Possible fixes
Make sure we always generate object by calling .to_json
method
Edited by Niko Belokolodov