Java Code Examples for io.micrometer.graphite.GraphiteMeterRegistry#start()

The following examples show how to use io.micrometer.graphite.GraphiteMeterRegistry#start() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MonitoringConfiguration.java    From Spring-Boot-2.0-Cookbook-Second-Edition with MIT License 6 votes vote down vote up
@Bean
public MetricsExporter graphiteExporter(GraphiteConfig graphiteConfig, Clock clock) {
    NamingConvention namingConvention = namingConvention();
    GraphiteMeterRegistry registry = new GraphiteMeterRegistry(graphiteConfig, (id, convention) -> {
        String prefix = "bookpub.app.";
        String tags = "";

        if (id.getTags().iterator().hasNext()) {
            tags = "." + id.getConventionTags(convention).stream()
                    .map(t -> t.getKey() + "." + t.getValue())
                    .map(nameSegment -> nameSegment.replace(" ", "_"))
                    .collect(Collectors.joining("."));
        }

        return prefix + id.getConventionName(convention) + tags;
    }, clock);
    registry.config().namingConvention(namingConvention);
    registry.start();
    return () -> registry;
}
 
Example 2
Source File: MonitoringConfiguration.java    From Spring-Boot-2.0-Cookbook-Second-Edition with MIT License 6 votes vote down vote up
@Bean
public MetricsExporter graphiteExporter(GraphiteConfig graphiteConfig, Clock clock) {
    NamingConvention namingConvention = namingConvention();
    GraphiteMeterRegistry registry = new GraphiteMeterRegistry(graphiteConfig, (id, convention) -> {
        String prefix = "bookpub.app.";
        String tags = "";

        if (id.getTags().iterator().hasNext()) {
            tags = "." + id.getConventionTags(convention).stream()
                    .map(t -> t.getKey() + "." + t.getValue())
                    .map(nameSegment -> nameSegment.replace(" ", "_"))
                    .collect(Collectors.joining("."));
        }

        return prefix + id.getConventionName(convention) + tags;
    }, clock);
    registry.config().namingConvention(namingConvention);
    registry.start();
    return () -> registry;
}
 
Example 3
Source File: MonitoringConfiguration.java    From Spring-Boot-2.0-Cookbook-Second-Edition with MIT License 6 votes vote down vote up
@Bean
public MetricsExporter graphiteExporter(GraphiteConfig graphiteConfig, Clock clock) {
    NamingConvention namingConvention = namingConvention();
    GraphiteMeterRegistry registry = new GraphiteMeterRegistry(graphiteConfig, (id, convention) -> {
        String prefix = "bookpub.app.";
        String tags = "";

        if (id.getTags().iterator().hasNext()) {
            tags = "." + id.getConventionTags(convention).stream()
                    .map(t -> t.getKey() + "." + t.getValue())
                    .map(nameSegment -> nameSegment.replace(" ", "_"))
                    .collect(Collectors.joining("."));
        }

        return prefix + id.getConventionName(convention) + tags;
    }, clock);
    registry.config().namingConvention(namingConvention);
    registry.start();
    return () -> registry;
}