keith-turner commented on code in PR #5021:
URL: https://github.com/apache/accumulo/pull/5021#discussion_r1822794192
##########
server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsInfoImpl.java:
##########
@@ -180,98 +100,75 @@ public void addMetricsProducers(MetricsProducer...
producer) {
"called addMetricsProducers() without providing at least one
producer - this has no effect");
return;
}
- lock.lock();
- try {
- if (composite == null) {
- producers.addAll(Arrays.asList(producer));
- } else {
- Arrays.stream(producer).forEach(p -> p.registerMetrics(composite));
- }
- } finally {
- lock.unlock();
- }
- }
- @Override
- public MeterRegistry getRegistry() {
- lock.lock();
- try {
- if (composite == null) {
- throw new IllegalStateException("metrics have not been initialized,
call init() first");
- }
- } finally {
- lock.unlock();
+ if (commonTags == null) {
+ producers.addAll(Arrays.asList(producer));
+ } else {
+ Arrays.stream(producer).forEach(p ->
p.registerMetrics(Metrics.globalRegistry));
}
- return composite;
}
@Override
- public void init() {
+ public synchronized void init(Collection<Tag> tags) {
Review Comment:
I'll give that a try, if it works it would be a nice improvement.
--
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]