use of com.codahale.metrics.MetricRegistry in project jackrabbit-oak by apache.
the class OutOfBandIndexer method configureEstimators.
private void configureEstimators(IndexUpdate indexUpdate) {
StatisticsProvider statsProvider = indexHelper.getStatisticsProvider();
if (statsProvider instanceof MetricStatisticsProvider) {
MetricRegistry registry = ((MetricStatisticsProvider) statsProvider).getRegistry();
indexUpdate.setTraversalRateEstimator(new MetricRateEstimator(REINDEX_LANE, registry));
}
NodeCounterMBeanEstimator estimator = new NodeCounterMBeanEstimator(indexHelper.getNodeStore());
indexUpdate.setNodeCountEstimator(estimator);
}
use of com.codahale.metrics.MetricRegistry in project sling by apache.
the class MetricWebConsolePlugin method addingService.
//~---------------------------------------------< ServiceTracker >
@Override
public MetricRegistry addingService(ServiceReference<MetricRegistry> serviceReference) {
MetricRegistry registry = context.getService(serviceReference);
registries.put(serviceReference, registry);
return registry;
}
use of com.codahale.metrics.MetricRegistry in project sling by apache.
the class JSONReporterTest method nan_value.
@SuppressWarnings("unchecked")
@Test
public void nan_value() throws Exception {
MetricRegistry registry = new MetricRegistry();
registry.register("test", new Gauge<Double>() {
@Override
public Double getValue() {
return Double.POSITIVE_INFINITY;
}
});
Map<String, Object> json = getJSON(registry);
assertTrue(((Map<String, Object>) json.get("gauges")).containsKey("test"));
}
use of com.codahale.metrics.MetricRegistry in project sling by apache.
the class MetricWebConsolePluginTest method inventory_text.
@Test
public void inventory_text() throws Exception {
MetricRegistry reg1 = new MetricRegistry();
reg1.meter("test1").mark(5);
context.registerService(MetricRegistry.class, reg1, regProps("foo"));
activatePlugin();
StringWriter sw = new StringWriter();
plugin.print(new PrintWriter(sw), Format.TEXT, false);
String out = sw.toString();
assertThat(out, containsString("foo:test1"));
assertThat(out, containsString("Meters"));
}
use of com.codahale.metrics.MetricRegistry in project spring-boot by spring-projects.
the class MetricRepositoryAutoConfigurationTests method dropwizardInstalledIfPresent.
@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));
}
Aggregations