use of io.micrometer.core.instrument.MeterRegistry in project spring-boot by spring-projects.
the class RabbitMetricsAutoConfigurationTests method autoConfiguredConnectionFactoryIsInstrumented.
@Test
void autoConfiguredConnectionFactoryIsInstrumented() {
this.contextRunner.run((context) -> {
MeterRegistry registry = context.getBean(MeterRegistry.class);
registry.get("rabbitmq.connections").meter();
});
}
use of io.micrometer.core.instrument.MeterRegistry in project spring-boot by spring-projects.
the class DataSourcePoolMetricsAutoConfigurationTests method hikariProxiedDataSourceCanBeInstrumented.
@Test
void hikariProxiedDataSourceCanBeInstrumented() {
this.contextRunner.withUserConfiguration(ProxiedHikariDataSourcesConfiguration.class).withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class)).run((context) -> {
context.getBean("proxiedDataSource", DataSource.class).getConnection();
context.getBean("delegateDataSource", DataSource.class).getConnection();
MeterRegistry registry = context.getBean(MeterRegistry.class);
registry.get("hikaricp.connections").tags("pool", "firstDataSource").meter();
registry.get("hikaricp.connections").tags("pool", "secondOne").meter();
});
}
use of io.micrometer.core.instrument.MeterRegistry in project spring-boot by spring-projects.
the class DataSourcePoolMetricsAutoConfigurationTests method dataSourceInstrumentationCanBeDisabled.
@Test
void dataSourceInstrumentationCanBeDisabled() {
this.contextRunner.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class)).withPropertyValues("management.metrics.enable.jdbc=false").run((context) -> {
context.getBean(DataSource.class).getConnection().getMetaData();
MeterRegistry registry = context.getBean(MeterRegistry.class);
assertThat(registry.find("jdbc.connections.max").tags("name", "dataSource").meter()).isNull();
});
}
use of io.micrometer.core.instrument.MeterRegistry in project spring-boot by spring-projects.
the class DataSourcePoolMetricsAutoConfigurationTests method hikariDataSourceInstrumentationCanBeDisabled.
@Test
void hikariDataSourceInstrumentationCanBeDisabled() {
this.contextRunner.withPropertyValues("management.metrics.enable.hikaricp=false").withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class)).run((context) -> {
context.getBean(DataSource.class).getConnection();
MeterRegistry registry = context.getBean(MeterRegistry.class);
assertThat(registry.find("hikaricp.connections").meter()).isNull();
});
}
use of io.micrometer.core.instrument.MeterRegistry in project spring-boot by spring-projects.
the class DataSourcePoolMetricsAutoConfigurationTests method autoConfiguredDataSourceIsInstrumented.
@Test
void autoConfiguredDataSourceIsInstrumented() {
this.contextRunner.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class)).run((context) -> {
context.getBean(DataSource.class).getConnection().getMetaData();
MeterRegistry registry = context.getBean(MeterRegistry.class);
registry.get("jdbc.connections.max").tags("name", "dataSource").meter();
});
}
Aggregations