hanishakoneru opened a new pull request #481:
URL: https://github.com/apache/ratis/pull/481
## What changes were proposed in this pull request?
MetricsRegistriesImpl throws a warning when creating RatisMetricsRegistry
without registering any reporters beforehand.
```
@Override
public RatisMetricRegistry create(MetricRegistryInfo info) {
return registries.put(info, () -> {
if (reporterRegistrations.isEmpty()) {
LOG.warn(
"First MetricRegistry has been created without registering
reporters. You may need to call" +
" MetricRegistries.global().addReporterRegistration(...)
before.");
StackTraceElement[] stackTrace =
Thread.currentThread().getStackTrace();
for(StackTraceElement element : stackTrace) {
LOG.warn(" " + element.getClassName() + " - " +
element.getMethodName() + " - " +
element.getLineNumber());
}
}
RatisMetricRegistry registry = factory.create(info);
reporterRegistrations.forEach(reg -> reg.accept(registry));
return registry;
});
}
```
This leads to a lot of noise in the logs as every ratis client logs this
message.
```
21/06/02 12:37:35 INFO metrics.RatisMetrics: Creating Metrics Registry :
ratis.client_message_metrics.client-CBAF50A69A13->24ecdbe1-e8c3-4211-94fc-31429681f184
21/06/02 12:37:35 WARN impl.MetricRegistriesImpl: First MetricRegistry has
been created without registering reporters. You may need to call
MetricRegistries.global().addReporterRegistration(...) before.
21/06/02 12:37:40 INFO metrics.RatisMetrics: Creating Metrics Registry :
ratis.client_message_metrics.client-1A65382B9313->082aff6d-b8b6-435b-993e-1b3b37b9770b
21/06/02 12:37:40 WARN impl.MetricRegistriesImpl: First MetricRegistry has
been created without registering reporters. You may need to call
MetricRegistries.global().addReporterRegistration(...) before.
21/06/02 12:37:44 INFO metrics.RatisMetrics: Creating Metrics Registry :
ratis.client_message_metrics.client-530530878B2F->06c72e97-a5ea-4474-b73c-5642d30ee3cf
21/06/02 12:37:44 WARN impl.MetricRegistriesImpl: First MetricRegistry has
been created without registering reporters. You may need to call
MetricRegistries.global().addReporterRegistration(...) before.
21/06/02 12:37:52 INFO metrics.RatisMetrics: Creating Metrics Registry :
ratis.client_message_metrics.client-B39FB0CD2151->24ecdbe1-e8c3-4211-94fc-31429681f184
21/06/02 12:37:52 WARN impl.MetricRegistriesImpl: First MetricRegistry has
been created without registering reporters. You may need to call
MetricRegistries.global().addReporterRegistration(...) before.
21/06/02 12:37:57 INFO metrics.RatisMetrics: Creating Metrics Registry :
ratis.client_message_metrics.client-12092E53EF9C->082aff6d-b8b6-435b-993e-1b3b37b9770b
21/06/02 12:37:57 WARN impl.MetricRegistriesImpl: First MetricRegistry has
been created without registering reporters. You may need to call
MetricRegistries.global().addReporterRegistration(...) before.
21/06/02 12:38:00 INFO metrics.RatisMetrics: Creating Metrics Registry :
ratis.client_message_metrics.client-89C870BA12C6->d5196d6f-753d-4113-87ef-2bfbba66c2af
21/06/02 12:38:00 WARN impl.MetricRegistriesImpl: First MetricRegistry has
been created without registering reporters. You may need to call
MetricRegistries.global().addReporterRegistration(...) before.
21/06/02 12:38:03 INFO metrics.RatisMetrics: Creating Metrics Registry :
ratis.client_message_metrics.client-A9412DBA8690->06c72e97-a5ea-4474-b73c-5642d30ee3cf
21/06/02 12:38:03 WARN impl.MetricRegistriesImpl: First MetricRegistry has
been created without registering reporters. You may need to call
MetricRegistries.global().addReporterRegistration(...) before.
21/06/02 12:38:25 INFO metrics.RatisMetrics: Creating Metrics Registry :
ratis.client_message_metrics.client-49743027A7AD->d5196d6f-753d-4113-87ef-2bfbba66c2af
21/06/02 12:38:25 WARN impl.MetricRegistriesImpl: First MetricRegistry has
been created without registering reporters. You may need to call
MetricRegistries.global().addReporterRegistration(...) before.
```
We can remove the warning message or at the least change it to debug level.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/RATIS-1381
## How was this patch tested?
Tested on an Ozone deployment.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]