use of io.opentelemetry.sdk.metrics.export.MetricReader in project opentelemetry-java by open-telemetry.
the class SdkMeterProviderTest method shutdown.
@Test
void shutdown() {
when(metricReader.shutdown()).thenReturn(CompletableResultCode.ofSuccess());
CompletableResultCode result = SdkMeterProvider.builder().registerMetricReader(unused -> metricReader).build().shutdown().join(10, TimeUnit.SECONDS);
assertThat(result.isSuccess()).isTrue();
}
use of io.opentelemetry.sdk.metrics.export.MetricReader in project opentelemetry-java by open-telemetry.
the class AutoConfiguredOpenTelemetrySdkTest method builder_addMeterProviderCustomizer.
@Test
void builder_addMeterProviderCustomizer() {
when(metricReaderFactory.apply(any())).thenReturn(metricReader);
Mockito.lenient().when(metricReader.shutdown()).thenReturn(CompletableResultCode.ofSuccess());
when(metricReader.flush()).thenReturn(CompletableResultCode.ofSuccess());
SdkMeterProvider sdkMeterProvider = builder.addMeterProviderCustomizer((meterProviderBuilder, configProperties) -> meterProviderBuilder.registerMetricReader(metricReaderFactory)).build().getOpenTelemetrySdk().getSdkMeterProvider();
sdkMeterProvider.forceFlush().join(10, TimeUnit.SECONDS);
verify(metricReader).flush();
}
Aggregations