io.micrometer.statsd.StatsdMeterRegistry Java Examples
The following examples show how to use
io.micrometer.statsd.StatsdMeterRegistry.
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: SampleRegistries.java From micrometer with Apache License 2.0 | 6 votes |
public static StatsdMeterRegistry datadogStatsd() { return new StatsdMeterRegistry(new StatsdConfig() { @Override public Duration step() { return Duration.ofSeconds(10); } @Override @Nullable public String get(String k) { return null; } @Override public StatsdFlavor flavor() { return StatsdFlavor.DATADOG; } }, Clock.SYSTEM); }
Example #2
Source File: SampleRegistries.java From micrometer with Apache License 2.0 | 6 votes |
public static StatsdMeterRegistry telegrafStatsd() { return new StatsdMeterRegistry(new StatsdConfig() { @Override public Duration step() { return Duration.ofSeconds(10); } @Override @Nullable public String get(String k) { return null; } @Override public StatsdFlavor flavor() { return StatsdFlavor.TELEGRAF; } }, Clock.SYSTEM); }
Example #3
Source File: SampleRegistries.java From micrometer with Apache License 2.0 | 6 votes |
public static StatsdMeterRegistry sysdigStatsd() { return new StatsdMeterRegistry(new StatsdConfig() { @Override public Duration step() { return Duration.ofSeconds(10); } @Override @Nullable public String get(String k) { return null; } @Override public StatsdFlavor flavor() { return StatsdFlavor.SYSDIG; } }, Clock.SYSTEM); }
Example #4
Source File: SampleRegistries.java From micrometer with Apache License 2.0 | 6 votes |
public static StatsdMeterRegistry etsyStatsd() { return new StatsdMeterRegistry(new StatsdConfig() { @Override public Duration step() { return Duration.ofSeconds(10); } @Override @Nullable public String get(String k) { return null; } @Override public StatsdFlavor flavor() { return StatsdFlavor.ETSY; } }, Clock.SYSTEM); }
Example #5
Source File: StatsProviderImpl.java From pravega with Apache License 2.0 | 6 votes |
@Synchronized @Override public void start() { init(); log.info("Metrics prefix: {}", conf.getMetricsPrefix()); if (conf.isEnableStatsDReporter()) { metrics.add(new StatsdMeterRegistry(RegistryConfigUtil.createStatsDConfig(conf), Clock.SYSTEM)); } if (conf.isEnableInfluxDBReporter()) { metrics.add(new InfluxMeterRegistry(RegistryConfigUtil.createInfluxConfig(conf), Clock.SYSTEM)); } metrics.config().commonTags(createHostTag(DEFAULT_HOSTNAME_KEY)); Preconditions.checkArgument(metrics.getRegistries().size() != 0, "No meter register bound hence no storage for metrics!"); }
Example #6
Source File: StatsProviderTest.java From pravega with Apache License 2.0 | 6 votes |
@Test public void testStatsProviderStartAndClose() { //To improve test case isolation, create a new registry instead of using the global one. CompositeMeterRegistry localRegistry = new CompositeMeterRegistry(); MetricsConfig appConfig = MetricsConfig.builder() .with(MetricsConfig.ENABLE_STATSD_REPORTER, true) .with(MetricsConfig.ENABLE_INFLUXDB_REPORTER, false) .build(); StatsProvider statsProvider = new StatsProviderImpl(appConfig, localRegistry); statsProvider.start(); for (MeterRegistry registry : localRegistry.getRegistries()) { assertFalse(registry instanceof InfluxMeterRegistry); assertTrue(registry instanceof StatsdMeterRegistry); } statsProvider.close(); assertTrue(0 == localRegistry.getRegistries().size()); }
Example #7
Source File: StatsProviderTest.java From pravega with Apache License 2.0 | 6 votes |
@Test public void testStatsProviderStartWithoutExporting() { MetricsConfig appConfig = MetricsConfig.builder() .with(MetricsConfig.ENABLE_STATSD_REPORTER, true) .with(MetricsConfig.ENABLE_INFLUXDB_REPORTER, true) .build(); CompositeMeterRegistry localRegistry = new CompositeMeterRegistry(); StatsProvider statsProvider = new StatsProviderImpl(appConfig, localRegistry); statsProvider.startWithoutExporting(); for (MeterRegistry registry : localRegistry.getRegistries()) { assertTrue(registry instanceof SimpleMeterRegistry); assertFalse(registry instanceof InfluxMeterRegistry); assertFalse(registry instanceof StatsdMeterRegistry); } statsProvider.close(); assertTrue(0 == localRegistry.getRegistries().size()); }
Example #8
Source File: MicroMeterMetricCollector.java From secor with Apache License 2.0 | 5 votes |
@Override public void initialize(SecorConfig config) { if (config.getMicroMeterCollectorStatsdEnabled()) { MeterRegistry statsdRegistry = new StatsdMeterRegistry(StatsdConfig.DEFAULT, Clock.SYSTEM); Metrics.addRegistry(statsdRegistry); } if (config.getMicroMeterCollectorJmxEnabled()) { MeterRegistry jmxRegistry = new JmxMeterRegistry(JmxConfig.DEFAULT, Clock.SYSTEM); Metrics.addRegistry(jmxRegistry); } }