Add uuid to Service Ping metadata report
What does this MR do and why?
Instances that Submits Service Ping sends also metadata report along with it. This metadata includes information about metrics collection timing in order to help detect and fix underperforming metrics. This commit adds uuid to metadata, in order to tie this metadata to instance Service Ping report to better understand context of problematic metrics
Relates #364645 (closed)
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
-
Checkout https://gitlab.com/gitlab-services/version-gitlab-com/-/merge_requests/690 and spin up local VersionApp server. If you do not have VersionApp set up locally follow this instruction
-
Change
ServicePing:SubmitService
to point to your local development VersionApp instance
diff --git a/app/services/service_ping/submit_service.rb b/app/services/service_ping/submit_service.rb
index 64793f5072c..e8236f9142d 100644
--- a/app/services/service_ping/submit_service.rb
+++ b/app/services/service_ping/submit_service.rb
@@ -102,6 +102,7 @@ def save_raw_usage_data(usage_data)
# See https://gitlab.com/gitlab-org/gitlab/-/issues/233615 for details
def base_url
Rails.env.production? ? PRODUCTION_BASE_URL : STAGING_BASE_URL
+ 'http://localhost:3000'
end
end
end
- In rails console
$ bin/rails c
enabled Service Ping and trigger report
[1] pry(main)> ApplicationSetting.current.update(usage_ping_enabled: true)
[2] pry(main)> ServicePing::SubmitService.new.execute
- Look for incoming request to
/usage_ping_metadata
output in VersionApp
Started POST "/usage_ping_metadata" for ::1 at 2022-04-07 13:30:44 +0200
Processing by UsagePingMetadataController#create as HTML
Parameters: {"uuid"=>"6b3578df-146d-4915-af4a-00fda80abac8", "metadata"=>{"metrics"=>[{"name"=>"version", "time_elapsed"=>3.00002284348011e-06}, {"name"=>"installation_type", "time_elapsed"=>8.999952115118504e-06}, {"name"=>"settings.ldap_encrypted_secrets_enabled", "time_elapsed"=>0.0013879999751225114}, {"name"=>"settings.smtp_encrypted_secrets_enabled", "time_elapsed"=>0.0005740000633522868}, {"name"=>"settings.operating_system", "time_elapsed"=>0.6089230000507087}, {"name"=>"settings.gitaly_apdex", "time_elapsed"=>0.012181999976746738}, {"name"=>"counts.assignee_lists", "time_elapsed"=>0.027057999977841973}, {"name"=>"counts.ci_builds", "time_elapsed"=>0.03883099998347461}, {"name"=>"counts.ci_internal_pipelines", "time_elapsed"=>0.029631000012159348},
....
{"uuid"=>"6b3578df-146d-4915-af4a-00fda80abac8", "metrics"=>[{"name"=>"usage_activity_by_stage_monthly.verify.projects_reporting_ci_cd_back_to_github", "time_elapsed"=>0.016271999920718372}, {"name"=>"installation_type", "time_elapsed"=>1.2999982573091984e-05}, {"name"=>"license_billable_users", "time_elapsed"=>0.001693999976851046}, {"name"=>"settings.ldap_encrypted_secrets_enabled", "time_elapsed"=>7.399998139590025e-05}, {"name"=>"settings.smtp_encrypted_secrets_enabled", "time_elapsed"=>3.300001844763756e-05}, {"name"=>"settings.operating_system", "time_elapsed"=>0.6754120000405237}, {"name"=>"settings.gitaly_apdex", "time_elapsed"=>0.0031090000411495566}, {"name"=>"counts.assignee_lists", "time_elapsed"=>0.013246000045910478}, {"name"=>"counts.ci_builds", "time_elapsed"=>0.014400999993085861}, {"name"=>"counts.ci_internal_pipelines", "time_elapsed"=>0.012971999938599765}]}
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.