ServicePing fails for EE license without active license
Summary
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 class.
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 affectec
Steps to reproduce
- Have EE instance without active license present
- In rails console trigger ServicePing
ServicePing::BuildPayloadService.new.execute
Example Project
What is the current bug behavior?
ServicePing fails for EE instances without active liecnse
What is the expected correct behavior?
ServicePing skips license metrics when license is not available
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
Add early return to all EE metrics that uses License.current
when license is not present.