@Override public void report() { if (this.filter.isPresent()) { report(this.context.getGauges(this.filter.get()), this.context.getCounters(this.filter.get()), this.context.getHistograms(this.filter.get()), this.context.getMeters(this.filter.get()), this.context.getTimers(this.filter.get())); } else { report(this.context.getGauges(), this.context.getCounters(), this.context.getHistograms(), this.context.getMeters(), this.context.getTimers()); } }
@Test(dependsOnMethods = "testGetMetrics") @SuppressWarnings("unchecked") public void testGetMetricsWithFilter() { MetricFilter filter = new MetricFilter() { @Override public boolean matches(String name, Metric metric) { return !name.equals(MetricContext.GOBBLIN_METRICS_NOTIFICATIONS_TIMER_NAME); } }; Map<String, Counter> counters = this.context.getCounters(filter); Assert.assertEquals(counters.size(), 1); Assert.assertTrue( counters.containsKey(RECORDS_PROCESSED)); Map<String, Meter> meters = this.context.getMeters(filter); Assert.assertEquals(meters.size(), 1); Assert.assertTrue( meters.containsKey(RECORD_PROCESS_RATE)); Map<String, Histogram> histograms = this.context.getHistograms(filter); Assert.assertEquals(histograms.size(), 1); Assert.assertTrue( histograms.containsKey(RECORD_SIZE_DISTRIBUTION)); Map<String, Timer> timers = this.context.getTimers(filter); Assert.assertEquals(timers.size(), 1); Assert.assertTrue(timers.containsKey(TOTAL_DURATION)); Map<String, Gauge> gauges = this.context.getGauges(filter); Assert.assertEquals(gauges.size(), 1); Assert.assertTrue(gauges.containsKey(QUEUE_SIZE)); }
Assert.assertTrue(timers.containsKey(TOTAL_DURATION)); Map<String, Gauge> gauges = this.context.getGauges(); Assert.assertEquals(gauges.size(), 1); Assert.assertTrue(gauges.containsKey(QUEUE_SIZE));
@Test public void testTaggableGauge() { ContextAwareGauge<Long> queueSize = this.context.newContextAwareGauge( QUEUE_SIZE, new Gauge<Long>() { @Override public Long getValue() { return 1000l; } }); this.context.register(QUEUE_SIZE, queueSize); Assert.assertEquals(queueSize.getValue().longValue(), 1000l); Assert.assertEquals( this.context.getGauges().get(queueSize.getName()), queueSize.getInnerMetric()); Assert.assertEquals(queueSize.getContext(), this.context); Assert.assertEquals(queueSize.getName(), QUEUE_SIZE); }
timer.update(3, TimeUnit.SECONDS); graphiteReporter.report(metricContext.getGauges(), metricContext.getCounters(), metricContext.getHistograms(), metricContext.getMeters(), metricContext.getTimers(), metricContext.getTagMap());
timer.update(3, TimeUnit.SECONDS); influxDBReporter.report(metricContext.getGauges(), metricContext.getCounters(), metricContext.getHistograms(), metricContext.getMeters(), metricContext.getTimers(), metricContext.getTagMap());
for (Map.Entry<String, ? extends com.codahale.metrics.Metric> entry : jobMetrics.getMetricContext().getGauges() .entrySet()) { Metric gauge = new Metric();
for (Map.Entry<String, ? extends com.codahale.metrics.Metric> entry : taskMetrics.getMetricContext().getGauges() .entrySet()) { Metric gauge = new Metric();
@Override public void report() { if (this.filter.isPresent()) { report(this.context.getGauges(this.filter.get()), this.context.getCounters(this.filter.get()), this.context.getHistograms(this.filter.get()), this.context.getMeters(this.filter.get()), this.context.getTimers(this.filter.get())); } else { report(this.context.getGauges(), this.context.getCounters(), this.context.getHistograms(), this.context.getMeters(), this.context.getTimers()); } }
for (Map.Entry<String, ? extends com.codahale.metrics.Metric> entry : jobMetrics.getMetricContext().getGauges() .entrySet()) { Metric gauge = new Metric();
for (Map.Entry<String, ? extends com.codahale.metrics.Metric> entry : taskMetrics.getMetricContext().getGauges() .entrySet()) { Metric gauge = new Metric();