use of io.dropwizard.metrics.MetricName 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