io.micrometer.graphite.GraphiteConfig Java Examples
The following examples show how to use
io.micrometer.graphite.GraphiteConfig.
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 |
@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 |
@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 |
@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 #4
Source File: Configuration.java From azure-cosmosdb-java with MIT License | 5 votes |
@SuppressWarnings("UnstableApiUsage") private synchronized MeterRegistry graphiteMeterRegistry(String serviceAddress) { if (this.graphiteMeterRegistry == null) { HostAndPort address = HostAndPort.fromString(serviceAddress); String host = address.getHost(); int port = address.getPortOrDefault(DEFAULT_GRAPHITE_SERVER_PORT); boolean enabled = !Boolean.getBoolean("cosmos.monitoring.graphite.disabled"); Duration step = Duration.ofSeconds(Integer.getInteger("cosmos.monitoring.graphite.step", this.printingInterval)); final GraphiteConfig config = new GraphiteConfig() { private String[] tagNames = { "source" }; @Override @Nullable public String get(@Nullable String key) { return null; } @Override public boolean enabled() { return enabled; } @Override @Nullable public String host() { return host; } @Override @Nullable public int port() { return port; } @Override @Nullable public Duration step() { return step; } @Override @Nullable public String[] tagsAsPrefix() { return this.tagNames; } }; this.graphiteMeterRegistry = new GraphiteMeterRegistry(config, Clock.SYSTEM); String source; try { PercentEscaper escaper = new PercentEscaper("_-", false); source = escaper.escape(InetAddress.getLocalHost().getHostName()); } catch (UnknownHostException error) { source = "unknown-host"; } this.graphiteMeterRegistry.config() .namingConvention(NamingConvention.dot) .commonTags("source", source); } return this.graphiteMeterRegistry; }
Example #5
Source File: SampleRegistries.java From micrometer with Apache License 2.0 | 5 votes |
public static GraphiteMeterRegistry graphite() { return new GraphiteMeterRegistry(new GraphiteConfig() { @Override public Duration step() { return Duration.ofSeconds(10); } @Override @Nullable public String get(String k) { return null; } }, Clock.SYSTEM); }
Example #6
Source File: MicrometerBasedMetricsTest.java From hono with Eclipse Public License 2.0 | 5 votes |
/** * Gets the Micrometer registries that the tests should be run against. * * @return The registries. */ public static Stream<MeterRegistry> registries() { return Stream.of(new MeterRegistry[] { new PrometheusMeterRegistry(PrometheusConfig.DEFAULT), new GraphiteMeterRegistry(GraphiteConfig.DEFAULT, Clock.SYSTEM) }); }