Search in sources :

Example 1 with GraphiteMeterRegistry

use of io.micrometer.graphite.GraphiteMeterRegistry in project spring-boot by spring-projects.

the class GraphiteMetricsExportAutoConfigurationTests method autoConfiguresWithTagsAsPrefixCanBeDisabled.

@Test
void autoConfiguresWithTagsAsPrefixCanBeDisabled() {
    this.contextRunner.withUserConfiguration(BaseConfiguration.class).withPropertyValues("management.metrics.export.graphite.tags-as-prefix=app", "management.metrics.export.graphite.graphite-tags-enabled=true").run((context) -> {
        assertThat(context).hasSingleBean(GraphiteMeterRegistry.class);
        GraphiteMeterRegistry registry = context.getBean(GraphiteMeterRegistry.class);
        registry.counter("test.count", Tags.of("app", "myapp"));
        assertThat(registry.getDropwizardRegistry().getMeters()).containsOnlyKeys("test.count;app=myapp");
    });
}
Also used : GraphiteMeterRegistry(io.micrometer.graphite.GraphiteMeterRegistry) Test(org.junit.jupiter.api.Test)

Example 2 with GraphiteMeterRegistry

use of io.micrometer.graphite.GraphiteMeterRegistry in project spring-boot by spring-projects.

the class GraphiteMetricsExportAutoConfigurationTests method autoConfiguresUseTagsAsPrefix.

@Test
void autoConfiguresUseTagsAsPrefix() {
    this.contextRunner.withUserConfiguration(BaseConfiguration.class).withPropertyValues("management.metrics.export.graphite.tags-as-prefix=app").run((context) -> {
        assertThat(context).hasSingleBean(GraphiteMeterRegistry.class);
        GraphiteMeterRegistry registry = context.getBean(GraphiteMeterRegistry.class);
        registry.counter("test.count", Tags.of("app", "myapp"));
        assertThat(registry.getDropwizardRegistry().getMeters()).containsOnlyKeys("myapp.testCount");
    });
}
Also used : GraphiteMeterRegistry(io.micrometer.graphite.GraphiteMeterRegistry) Test(org.junit.jupiter.api.Test)

Example 3 with GraphiteMeterRegistry

use of io.micrometer.graphite.GraphiteMeterRegistry in project spring-boot by spring-projects.

the class GraphiteMetricsExportAutoConfigurationTests method stopsMeterRegistryWhenContextIsClosed.

@Test
void stopsMeterRegistryWhenContextIsClosed() {
    this.contextRunner.withUserConfiguration(BaseConfiguration.class).run((context) -> {
        GraphiteMeterRegistry registry = context.getBean(GraphiteMeterRegistry.class);
        assertThat(registry.isClosed()).isFalse();
        context.close();
        assertThat(registry.isClosed()).isTrue();
    });
}
Also used : GraphiteMeterRegistry(io.micrometer.graphite.GraphiteMeterRegistry) Test(org.junit.jupiter.api.Test)

Aggregations

GraphiteMeterRegistry (io.micrometer.graphite.GraphiteMeterRegistry)3 Test (org.junit.jupiter.api.Test)3