use of io.micrometer.core.instrument.MeterRegistry in project spring-boot by spring-projects.
the class RestTemplateMetricsConfigurationTests method restTemplateCreatedWithBuilderIsInstrumented.
@Test
void restTemplateCreatedWithBuilderIsInstrumented() {
this.contextRunner.run((context) -> {
MeterRegistry registry = context.getBean(MeterRegistry.class);
RestTemplateBuilder builder = context.getBean(RestTemplateBuilder.class);
validateRestTemplate(builder, registry);
});
}
use of io.micrometer.core.instrument.MeterRegistry in project spring-boot by spring-projects.
the class WebMvcMetricsAutoConfigurationTests method shouldNotDenyNorLogIfMaxUrisIsNotReached.
@Test
void shouldNotDenyNorLogIfMaxUrisIsNotReached(CapturedOutput output) {
this.contextRunner.withUserConfiguration(TestController.class).withConfiguration(AutoConfigurations.of(MetricsAutoConfiguration.class, WebMvcAutoConfiguration.class)).withPropertyValues("management.metrics.web.server.max-uri-tags=5").run((context) -> {
MeterRegistry registry = getInitializedMeterRegistry(context);
assertThat(registry.get("http.server.requests").meters()).hasSize(3);
assertThat(output).doesNotContain("Reached the maximum number of URI tags for 'http.server.requests'");
});
}
use of io.micrometer.core.instrument.MeterRegistry in project spring-boot by spring-projects.
the class WebMvcMetricsAutoConfigurationTests method afterMaxUrisReachedFurtherUrisAreDenied.
@Test
void afterMaxUrisReachedFurtherUrisAreDenied(CapturedOutput output) {
this.contextRunner.withUserConfiguration(TestController.class).withConfiguration(AutoConfigurations.of(MetricsAutoConfiguration.class, WebMvcAutoConfiguration.class)).withPropertyValues("management.metrics.web.server.max-uri-tags=2").run((context) -> {
MeterRegistry registry = getInitializedMeterRegistry(context);
assertThat(registry.get("http.server.requests").meters()).hasSize(2);
assertThat(output).contains("Reached the maximum number of URI tags for 'http.server.requests'");
});
}
use of io.micrometer.core.instrument.MeterRegistry in project spring-boot by spring-projects.
the class WebMvcMetricsAutoConfigurationTests method autoTimeRequestsCanBeConfigured.
@Test
void autoTimeRequestsCanBeConfigured() {
this.contextRunner.withUserConfiguration(TestController.class).withConfiguration(AutoConfigurations.of(MetricsAutoConfiguration.class, WebMvcAutoConfiguration.class)).withPropertyValues("management.metrics.web.server.request.autotime.enabled=true", "management.metrics.web.server.request.autotime.percentiles=0.5,0.7", "management.metrics.web.server.request.autotime.percentiles-histogram=true").run((context) -> {
MeterRegistry registry = getInitializedMeterRegistry(context);
Timer timer = registry.get("http.server.requests").timer();
HistogramSnapshot snapshot = timer.takeSnapshot();
assertThat(snapshot.percentileValues()).hasSize(2);
assertThat(snapshot.percentileValues()[0].percentile()).isEqualTo(0.5);
assertThat(snapshot.percentileValues()[1].percentile()).isEqualTo(0.7);
});
}
use of io.micrometer.core.instrument.MeterRegistry in project spring-boot by spring-projects.
the class ConnectionPoolMetricsAutoConfigurationTests method connectionPoolInstrumentationCanBeDisabled.
@Test
void connectionPoolInstrumentationCanBeDisabled() {
this.contextRunner.withConfiguration(AutoConfigurations.of(R2dbcAutoConfiguration.class)).withPropertyValues("management.metrics.enable.r2dbc=false").run((context) -> {
MeterRegistry registry = context.getBean(MeterRegistry.class);
assertThat(registry.find("r2dbc.pool.acquired").gauge()).isNull();
});
}
Aggregations