liuxiaocs7 commented on code in PR #7855:
URL: https://github.com/apache/hbase/pull/7855#discussion_r2891308105
##########
hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/metrics/impl/GlobalMetricRegistriesAdapter.java:
##########
@@ -63,15 +63,17 @@ public final class GlobalMetricRegistriesAdapter {
private static final Logger LOG =
LoggerFactory.getLogger(GlobalMetricRegistriesAdapter.class);
private class MetricsSourceAdapter implements MetricsSource {
- private final MetricRegistry registry;
+ private final MetricRegistryInfo info;
- MetricsSourceAdapter(MetricRegistry registry) {
- this.registry = registry;
+ MetricsSourceAdapter(MetricRegistryInfo info) {
+ this.info = info;
}
@Override
public void getMetrics(MetricsCollector collector, boolean all) {
- metricsAdapter.snapshotAllMetrics(registry, collector);
+ Optional<MetricRegistry> registryOpt =
MetricRegistries.global().get(info);
+ registryOpt
+ .ifPresent(metricRegistry ->
metricsAdapter.snapshotAllMetrics(metricRegistry, collector));
Review Comment:
this is the fix
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]