When MetricGroup registers Metrics in MetricRegistryImpl, sometimes the registration fails due to exceptions. However, currently it only logs "Error while registering metric" with no more information, which is inconvenient for users to troubleshoot which metric fails and why it fails.
Also, the warning log in registration and unregistration are both "Error while registering metric". This will lead users to confusion (although users can locate the correct place according to the call stack).
So I propose to log metric name when the metrics fails on registration/unregistration.