@Test public void createServices() throws Exception { this.context = new AnnotationConfigApplicationContext( MetricRepositoryAutoConfiguration.class); GaugeService gaugeService = this.context.getBean(BufferGaugeService.class); assertThat(gaugeService).isNotNull(); assertThat(this.context.getBean(BufferCounterService.class)).isNotNull(); assertThat(this.context.getBean(PrefixMetricReader.class)).isNotNull(); gaugeService.submit("foo", 2.7); MetricReader bean = this.context.getBean(MetricReader.class); assertThat(bean.findOne("gauge.foo").getValue()).isEqualTo(2.7); }
@Test public void createServices() throws Exception { this.context = new AnnotationConfigApplicationContext( MetricRepositoryAutoConfiguration.class); GaugeService gaugeService = this.context.getBean(BufferGaugeService.class); assertNotNull(gaugeService); assertNotNull(this.context.getBean(BufferCounterService.class)); assertNotNull(this.context.getBean(PrefixMetricReader.class)); gaugeService.submit("foo", 2.7); assertEquals(2.7, this.context.getBean(MetricReader.class).findOne("gauge.foo").getValue()); }
/** * Create a new exporter for metrics to a writer based on a prefix for the metric * names. * @param reader a reader as the source of metrics * @param writer the writer to send the metrics to * @param prefix the prefix for metrics to export */ public PrefixMetricGroupExporter(PrefixMetricReader reader, PrefixMetricWriter writer, String prefix) { super(prefix); this.reader = reader; this.writer = writer; }
/** * Create a new exporter for metrics to a writer based on an empty prefix for the * metric names. * @param reader a reader as the source of metrics * @param writer the writer to send the metrics to */ public PrefixMetricGroupExporter(PrefixMetricReader reader, PrefixMetricWriter writer) { this(reader, writer, ""); }