Suppress logging from PeriodicMetricReader during tests (#5929)

This commit is contained in:
Lauri Tulmin 2022-04-26 02:47:07 +03:00 committed by GitHub
parent f2714ad021
commit 35d5f58e5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -34,6 +34,13 @@ public class AgentTestingCustomizer implements AutoConfigurationCustomizerProvid
autoConfigurationCustomizer.addTracerProviderCustomizer(
(tracerProvider, config) -> tracerProvider.addSpanProcessor(spanProcessor));
// as we configure PeriodicMetricReader with a short interval it repeatedly logs
// No metric data to export - skipping export.
// to get rid of these log lines we change PeriodicMetricReader log level from DEBUG to INFO
System.setProperty(
"io.opentelemetry.javaagent.slf4j.simpleLogger.log.io.opentelemetry.sdk.metrics.export.PeriodicMetricReader",
"INFO");
autoConfigurationCustomizer.addMeterProviderCustomizer(
(meterProvider, config) -> meterProvider.registerMetricReader(metricReader));
}