Disable periodic metric reading in tests (#6025)
This commit is contained in:
parent
1df75378a1
commit
c166c937b3
|
@ -23,7 +23,9 @@ public class AgentTestingCustomizer implements AutoConfigurationCustomizerProvid
|
|||
|
||||
static final MetricReader metricReader =
|
||||
PeriodicMetricReader.builder(AgentTestingExporterFactory.metricExporter)
|
||||
.setInterval(Duration.ofMillis(100))
|
||||
// Set really long interval. We'll call forceFlush when we need the metrics
|
||||
// instead of collecting them periodically.
|
||||
.setInterval(Duration.ofNanos(Long.MAX_VALUE))
|
||||
.build();
|
||||
|
||||
static void reset() {
|
||||
|
|
|
@ -19,6 +19,7 @@ public class AgentTestingExporterFactory {
|
|||
}
|
||||
|
||||
public static List<byte[]> getMetricExportRequests() {
|
||||
AgentTestingCustomizer.metricReader.forceFlush().join(10, TimeUnit.SECONDS);
|
||||
return metricExporter.getCollectedExportRequests();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue