@Test public void dropwizardInstalledIfPresent() { this.context = new AnnotationConfigApplicationContext( MetricsDropwizardAutoConfiguration.class, MetricRepositoryAutoConfiguration.class, AopAutoConfiguration.class); GaugeService gaugeService = this.context.getBean(GaugeService.class); assertThat(gaugeService).isNotNull(); gaugeService.submit("foo", 2.7); DropwizardMetricServices exporter = this.context .getBean(DropwizardMetricServices.class); assertThat(exporter).isEqualTo(gaugeService); MetricRegistry registry = this.context.getBean(MetricRegistry.class); @SuppressWarnings("unchecked") Gauge<Double> gauge = (Gauge<Double>) registry.getMetrics().get("gauge.foo"); assertThat(gauge.getValue()).isEqualTo(new Double(2.7)); }
@Test public void dropwizardInstalledIfPresent() { this.context = new AnnotationConfigApplicationContext( MetricsDropwizardAutoConfiguration.class, MetricRepositoryAutoConfiguration.class, AopAutoConfiguration.class); GaugeService gaugeService = this.context.getBean(GaugeService.class); assertNotNull(gaugeService); gaugeService.submit("foo", 2.7); DropwizardMetricServices exporter = this.context .getBean(DropwizardMetricServices.class); assertEquals(gaugeService, exporter); MetricRegistry registry = this.context.getBean(MetricRegistry.class); @SuppressWarnings("unchecked") Gauge<Double> gauge = (Gauge<Double>) registry.getMetrics().get("gauge.foo"); assertEquals(new Double(2.7), gauge.getValue()); }
@Bean @ConditionalOnMissingBean({ DropwizardMetricServices.class, CounterService.class, GaugeService.class }) public DropwizardMetricServices dropwizardMetricServices( MetricRegistry metricRegistry) { return new DropwizardMetricServices(metricRegistry); }
@Autowired public DefaultMetricsExporter(OntrackConfigProperties config, DropwizardMetricServices metricWriter, Collection<MetricsSource> metricsSources) { super(""); this.config = config; this.metricWriter = metricWriter; this.metricsSources = metricsSources; this.executor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("metrics-exporter-%d") .build() ); }
public MetricsUtilService(DropwizardMetricServices metricService) { this.metricService = metricService; }
public UserRepository(DSLContext dslContext, DropwizardMetricServices metricService) { this.dslContext = dslContext; this.metricService = metricService; }
@Bean RedisCacheMonitor cacheMonitor(RedisConnectionFactory redisConnectionFactory, DropwizardMetricServices metricServices) { return new RedisCacheMonitor(redisConnectionFactory, metricServices); }
public RedisCacheMonitor(RedisConnectionFactory redisConnectionFactory, DropwizardMetricServices metricServices) { this.redisConnectionFactory = redisConnectionFactory; this.metricServices = metricServices; }
@Bean public DropwizardMetricServices dropwizardMetricServices() { return new DropwizardMetricServices(metricRegistry); }