Resolve "ServicePing fails for EE license without active license"
What does this MR do and why?
What happened
With !77629 (merged) ServicePing reporting process when encountering missing metric based on metrics YAMLs definitions attempts to compute it with appointed metric instrumentation class. In ee/lib/ee/gitlab/usage_data.rb#L88
file, license related metric were only included if there is active license present for given instance. That caused those metrics being missing for EE instances without active license, and made ServicePing attempt to use instrumentation classes. However
metrics instrumentation classes in EE
directory does not account for EE instances without active license, and raises missing methods errors for nil license.
What are the consequences
Because some of License.current
calls are made outside of hardening methods (eg: https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/gitlab/usage/metrics/instrumentations/license_metric.rb#L35), all ServicePing process fails if instance is affected
What this MR does
It skips affected metrics when scanning for missing metrics in legacy usage_data.rb
payload that are supposed to be sourced from instrumentation classes.
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
- Have EE instance without active license present
- In rails console trigger ServicePing
ServicePing::BuildPayloadService.new.execute
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 #354981 (closed)