@Test public void forEachWorksOnMetricsFromBothRegistries() { Timer timer = registry1.timer(METRIC_NAME_1); Histogram histogram = registry2.histogram(METRIC_NAME_2); Meter meter = registry1.meter(METRIC_NAME_3); Map<MetricName, Metric> stateOfTheWorld = Maps.newHashMap(); disjointUnionTaggedMetricSet.forEachMetric(stateOfTheWorld::put); assertThat(stateOfTheWorld).containsExactlyInAnyOrderEntriesOf( ImmutableMap.of(METRIC_NAME_1, timer, METRIC_NAME_2, histogram, METRIC_NAME_3, meter)); }
@Override public void forEachMetric(BiConsumer<MetricName, Metric> consumer) { first.forEachMetric(consumer); second.forEachMetric(consumer); }
DisjointUnionTaggedMetricSet implements TaggedMetricSet { @Override public void forEachMetric(BiConsumer<MetricName, Metric> consumer) { first.forEachMetric(consumer); second.forEachMetric(consumer); } }
DisjointUnionTaggedMetricSet implements TaggedMetricSet { @Override public void forEachMetric(BiConsumer<MetricName, Metric> consumer) { first.forEachMetric(consumer); second.forEachMetric(consumer); } DisjointUnionTaggedMetricSet(TaggedMetricSet first, TaggedMetricSet second); }
DisjointUnionTaggedMetricSet implements TaggedMetricSet { @Override public void forEachMetric(BiConsumer<MetricName, Metric> consumer) { first.forEachMetric(consumer); second.forEachMetric(consumer); } DisjointUnionTaggedMetricSet(TaggedMetricSet first, TaggedMetricSet second); @Override Map<MetricName, Metric> getMetrics(); @Override void forEachMetric(BiConsumer<MetricName, Metric> consumer); }
DisjointUnionTaggedMetricSet implements TaggedMetricSet { @Override public void forEachMetric(BiConsumer<MetricName, Metric> consumer) { first.forEachMetric(consumer); second.forEachMetric(consumer); } DisjointUnionTaggedMetricSet(TaggedMetricSet first, TaggedMetricSet second); @Override Map<MetricName, Metric> getMetrics(); @Override void forEachMetric(BiConsumer<MetricName, Metric> consumer);  }