@Test(dependsOnMethods = { "testContextAwareCounter", "testContextAwareMeter", "testContextAwareHistogram", "testContextAwareTimer", "testTaggableGauge" }) public void testGetMetrics() { SortedSet<String> names = this.context.getNames(); Assert.assertEquals(names.size(), 6); Assert.assertTrue(names.contains(RECORDS_PROCESSED)); Assert.assertTrue(names.contains(RECORD_PROCESS_RATE)); Assert.assertTrue( names.contains(RECORD_SIZE_DISTRIBUTION)); Assert.assertTrue(names.contains(TOTAL_DURATION)); Assert.assertTrue(names.contains(QUEUE_SIZE)); SortedSet<String> childNames = this.childContext.getNames(); Assert.assertEquals(childNames.size(), 4); Assert.assertTrue( childNames.contains(RECORDS_PROCESSED)); Assert.assertTrue( childNames.contains(RECORD_PROCESS_RATE)); Assert.assertTrue( childNames.contains(RECORD_SIZE_DISTRIBUTION)); Map<String, Metric> metrics = this.context.getMetrics(); Assert.assertEquals(metrics.size(), 6); Assert.assertTrue( metrics.containsKey(RECORDS_PROCESSED)); Assert.assertTrue( metrics.containsKey(RECORD_PROCESS_RATE)); Assert.assertTrue( metrics.containsKey(RECORD_SIZE_DISTRIBUTION)); Assert.assertTrue(metrics.containsKey(TOTAL_DURATION)); Assert.assertTrue(metrics.containsKey(QUEUE_SIZE)); Map<String, Counter> counters = this.context.getCounters(); Assert.assertEquals(counters.size(), 1); Assert.assertTrue( counters.containsKey(RECORDS_PROCESSED)); Map<String, Meter> meters = this.context.getMeters(); Assert.assertEquals(meters.size(), 1); Assert.assertTrue( meters.containsKey(RECORD_PROCESS_RATE)); Map<String, Histogram> histograms = this.context.getHistograms(); Assert.assertEquals(histograms.size(), 1); Assert.assertTrue( histograms.containsKey(RECORD_SIZE_DISTRIBUTION)); Map<String, Timer> timers = this.context.getTimers(); Assert.assertEquals(timers.size(), 2); Assert.assertTrue(timers.containsKey(TOTAL_DURATION)); Map<String, Gauge> gauges = this.context.getGauges(); Assert.assertEquals(gauges.size(), 1); Assert.assertTrue(gauges.containsKey(QUEUE_SIZE)); }
@Override public Map<String, Metric> getMetrics() { return this.innerMetricContext.getMetrics(); }
MetricContext extends MetricRegistry implements ReportableContext, Closeable { @Override public Map<String, Metric> getMetrics() { return this.innerMetricContext.getMetrics(); } }
MetricContext extends MetricRegistry implements ReportableContext, Closeable { @Override public Map<String, Metric> getMetrics() { return this.innerMetricContext.getMetrics(); } protected  MetricContext(String name, MetricContext parent, List<Tag<?>> tags, boolean isRoot); }
MetricContext extends MetricRegistry implements ReportableContext, Closeable { @Override public Map<String, Metric> getMetrics() { return this.innerMetricContext.getMetrics(); } protected  MetricContext(String name, MetricContext parent, List<Tag<?>> tags, boolean isRoot); String getName(); Optional<MetricContext> getParent(); Map<String, MetricContext> getChildContextsAsMap(); @Override SortedSet<String> getNames(); void submitEvent(GobblinTrackingEvent nonReusableEvent); @Override Map<String, Metric> getMetrics(); @Override SortedMap<String, Gauge> getGauges(); @Override SortedMap<String, Gauge> getGauges(MetricFilter filter); @Override SortedMap<String, Counter> getCounters(); @Override SortedMap<String, Counter> getCounters(MetricFilter filter); @Override SortedMap<String, Histogram> getHistograms(); @Override SortedMap<String, Histogram> getHistograms(MetricFilter filter); @Override SortedMap<String, Meter> getMeters(); @Override SortedMap<String, Meter> getMeters(MetricFilter filter); @Override SortedMap<String, Timer> getTimers(); @Override SortedMap<String, Timer> getTimers(MetricFilter filter); @Override Counter counter(String name); @Override Meter meter(String name); @Override Histogram histogram(String name); @Override ContextAwareTimer timer(String name); @Override synchronized T register(String name, T metric); T register(T metric); ContextAwareCounter contextAwareCounter(String name); ContextAwareCounter contextAwareCounter(String name, ContextAwareMetricFactory<ContextAwareCounter> factory); ContextAwareMeter contextAwareMeter(String name); ContextAwareMeter contextAwareMeter(String name, ContextAwareMetricFactory<ContextAwareMeter> factory); ContextAwareHistogram contextAwareHistogram(String name); ContextAwareHistogram contextAwareHistogram(String name, long windowSize, TimeUnit unit); ContextAwareTimer contextAwareTimer(String name); ContextAwareTimer contextAwareTimer(String name, long windowSize, TimeUnit unit); ContextAwareGauge<T> newContextAwareGauge(String name, Gauge<T> gauge); @Override synchronized boolean remove(String name); @Override void removeMatching(MetricFilter filter); List<Tag<?>> getTags(); Map<String, Object> getTagMap(); @Override void close(); Builder childBuilder(String name); static Builder builder(String name); UUID addNotificationTarget(Function<Notification, Void> target); void removeNotificationTarget(UUID key); void sendNotification(final Notification notification); }
MetricContext extends MetricRegistry implements ReportableContext, Closeable { @Override public Map<String, Metric> getMetrics() { return this.innerMetricContext.getMetrics(); } protected  MetricContext(String name, MetricContext parent, List<Tag<?>> tags, boolean isRoot); String getName(); Optional<MetricContext> getParent(); Map<String, MetricContext> getChildContextsAsMap(); @Override SortedSet<String> getNames(); void submitEvent(GobblinTrackingEvent nonReusableEvent); @Override Map<String, Metric> getMetrics(); @Override SortedMap<String, Gauge> getGauges(); @Override SortedMap<String, Gauge> getGauges(MetricFilter filter); @Override SortedMap<String, Counter> getCounters(); @Override SortedMap<String, Counter> getCounters(MetricFilter filter); @Override SortedMap<String, Histogram> getHistograms(); @Override SortedMap<String, Histogram> getHistograms(MetricFilter filter); @Override SortedMap<String, Meter> getMeters(); @Override SortedMap<String, Meter> getMeters(MetricFilter filter); @Override SortedMap<String, Timer> getTimers(); @Override SortedMap<String, Timer> getTimers(MetricFilter filter); @Override Counter counter(String name); @Override Meter meter(String name); @Override Histogram histogram(String name); @Override ContextAwareTimer timer(String name); @Override synchronized T register(String name, T metric); T register(T metric); ContextAwareCounter contextAwareCounter(String name); ContextAwareCounter contextAwareCounter(String name, ContextAwareMetricFactory<ContextAwareCounter> factory); ContextAwareMeter contextAwareMeter(String name); ContextAwareMeter contextAwareMeter(String name, ContextAwareMetricFactory<ContextAwareMeter> factory); ContextAwareHistogram contextAwareHistogram(String name); ContextAwareHistogram contextAwareHistogram(String name, long windowSize, TimeUnit unit); ContextAwareTimer contextAwareTimer(String name); ContextAwareTimer contextAwareTimer(String name, long windowSize, TimeUnit unit); ContextAwareGauge<T> newContextAwareGauge(String name, Gauge<T> gauge); @Override synchronized boolean remove(String name); @Override void removeMatching(MetricFilter filter); List<Tag<?>> getTags(); Map<String, Object> getTagMap(); @Override void close(); Builder childBuilder(String name); static Builder builder(String name); UUID addNotificationTarget(Function<Notification, Void> target); void removeNotificationTarget(UUID key); void sendNotification(final Notification notification); static final String METRIC_CONTEXT_ID_TAG_NAME; static final String METRIC_CONTEXT_NAME_TAG_NAME; static final String GOBBLIN_METRICS_NOTIFICATIONS_TIMER_NAME; }