dlmarion commented on code in PR #5021:
URL: https://github.com/apache/accumulo/pull/5021#discussion_r1820642506
##########
server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsInfoImpl.java:
##########
@@ -251,23 +206,42 @@ public DistributionStatisticConfig configure(Meter.Id id,
String userRegistryFactories =
context.getConfiguration().get(Property.GENERAL_MICROMETER_FACTORY);
+ List<MeterRegistry> registries = new ArrayList<>();
+
for (String factoryName : getTrimmedStrings(userRegistryFactories)) {
try {
MeterRegistry registry = getRegistryFromFactory(factoryName,
context);
registry.config().commonTags(commonTags.values());
registry.config().meterFilter(replicationFilter);
- addRegistry(registry);
+ registries.add(registry);
} catch (ReflectiveOperationException ex) {
LOG.warn("Could not load registry {}", factoryName, ex);
}
}
- pendingRegistries.forEach(registry -> composite.add(registry));
+ if (registries.size() == 1) {
+ meterRegistry = registries.get(0);
+ } else {
+ var composite = new CompositeMeterRegistry();
+ composite.config().commonTags(commonTags.values());
+ registries.forEach(composite::add);
+ meterRegistry = composite;
Review Comment:
I dug into this a little bit, and I think that metrics are *not* collected
as long as we don't set a MeterRegistry on the global one. Reason being that
the global registry is a CompositeMeterRegistry, and when a Meter is created on
a CompositeMeterRegistry, it creates it on the first child MeterRegistry. If
there is not one, then it uses a NoopMeter.
--
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]