use of io.dropwizard.metrics.MetricSet in project light-4j by networknt.
the class MetricRegistryTest method registersMultipleMetrics.
@Test
public void registersMultipleMetrics() throws Exception {
final MetricSet metrics = () -> {
final Map<MetricName, Metric> metrics1 = new HashMap<>();
metrics1.put(GAUGE2, gauge);
metrics1.put(COUNTER2, counter);
return metrics1;
};
registry.registerAll(metrics);
assertThat(registry.getNames()).containsOnly(GAUGE2, COUNTER2);
}
use of io.dropwizard.metrics.MetricSet in project light-4j by networknt.
the class MetricRegistryTest method registersMultipleMetricsWithAPrefix.
@Test
public void registersMultipleMetricsWithAPrefix() throws Exception {
final MetricName myCounter = MetricName.build("my.counter");
final MetricName myGauge = MetricName.build("my.gauge");
final MetricSet metrics = () -> {
final Map<MetricName, Metric> metrics1 = new HashMap<>();
metrics1.put(GAUGE, gauge);
metrics1.put(COUNTER, counter);
return metrics1;
};
registry.register("my", metrics);
assertThat(registry.getNames()).containsOnly(myGauge, myCounter);
}
use of io.dropwizard.metrics.MetricSet in project light-4j by networknt.
the class MetricRegistryTest method registersRecursiveMetricSets.
@Test
public void registersRecursiveMetricSets() throws Exception {
final MetricSet inner = () -> {
final Map<MetricName, Metric> metrics = new HashMap<>();
metrics.put(GAUGE, gauge);
return metrics;
};
final MetricSet outer = () -> {
final Map<MetricName, Metric> metrics = new HashMap<>();
metrics.put(MetricName.build("inner"), inner);
metrics.put(COUNTER, counter);
return metrics;
};
registry.register("my", outer);
final MetricName myCounter = MetricName.build("my.counter");
final MetricName myInnerGauge = MetricName.build("my.inner.gauge");
assertThat(registry.getNames()).containsOnly(myInnerGauge, myCounter);
}
Aggregations