mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-30 05:43:58 +00:00
Automatic merge from submit-queue (batch tested with PRs 53444, 52067, 53571, 53182). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Return an error if metric cannot be registered **What this PR does / why we need it**: `prometheus.MustRegister` panics if a metric cannot be registered. This PR replaces it with `prometheus.Register`, as it does not panic, and returns the error if the metric cannot be registered. I also adds lacking tests for `RegisterMetricAndTrackRateLimiterUsage`. **Which issue this PR fixes**: Fixes #52872 **Special notes for your reviewer**: None of the `metrics.RegisterMetricAndTrackRateLimiterUsage` invocations check the returned error, so I plan to submit new PRs to address this. **Release note**: ```release-note NONE ``` /sig instrumentation