/** * This is equivalent to {@link #contextAwareHistogram(String)}. */ @Override public Histogram histogram(String name) { return contextAwareHistogram(name); }
public HelixManagerMetrics(final MetricContext metricContext, final Config config) { int timeWindowSizeInMinutes = ConfigUtils.getInt(config, ConfigurationKeys.METRIC_TIMER_WINDOW_SIZE_IN_MINUTES, ConfigurationKeys.DEFAULT_METRIC_TIMER_WINDOW_SIZE_IN_MINUTES); this.clusterLeadershipChange = metricContext.contextAwareHistogram(CLUSTER_LEADERSHIP_CHANGE, timeWindowSizeInMinutes, TimeUnit.MINUTES); this.contextAwareMetrics.add(clusterLeadershipChange); }
public Metrics(final MetricContext metricContext, Config config) { int timeWindowSizeInMinutes = ConfigUtils.getInt(config, ConfigurationKeys.METRIC_TIMER_WINDOW_SIZE_IN_MINUTES, ConfigurationKeys.DEFAULT_METRIC_TIMER_WINDOW_SIZE_IN_MINUTES); this.serviceLeadershipChange = metricContext.contextAwareHistogram(SERVICE_LEADERSHIP_CHANGE, timeWindowSizeInMinutes, TimeUnit.MINUTES); this.contextAwareMetrics.add(this.serviceLeadershipChange); } }
InnerHistogram(MetricContext context, String name, ContextAwareHistogram contextAwareHistogram, long windowSize, TimeUnit unit) { super(new SlidingTimeWindowReservoir(windowSize, unit)); this.name = name; Optional<MetricContext> parentContext = context.getParent(); if (parentContext.isPresent()) { this.parentHistogram = Optional.fromNullable(parentContext.get().contextAwareHistogram(name, windowSize, unit)); } else { this.parentHistogram = Optional.absent(); } this.contextAwareHistogram = new WeakReference<>(contextAwareHistogram); }
InnerHistogram(MetricContext context, String name, ContextAwareHistogram contextAwareHistogram) { super(new ExponentiallyDecayingReservoir()); this.name = name; Optional<MetricContext> parentContext = context.getParent(); if (parentContext.isPresent()) { this.parentHistogram = Optional.fromNullable(parentContext.get().contextAwareHistogram(name)); } else { this.parentHistogram = Optional.absent(); } this.contextAwareHistogram = new WeakReference<>(contextAwareHistogram); }
Meter recordProcessRateMeter = this.context.contextAwareMeter(RECORD_PROCESS_RATE); Timer recordProcessTimeTimer = this.context.contextAwareTimer(RECORD_PROCESS_TIME); Histogram recordSizesHistogram = this.context.contextAwareHistogram(RECORD_SIZES);
@Test(dependsOnMethods = "testChildContext") public void testContextAwareHistogram() { ContextAwareHistogram jobRecordSizeDist = this.context.contextAwareHistogram(RECORD_SIZE_DISTRIBUTION); Assert.assertEquals( this.context.getHistograms().get( jobRecordSizeDist.getName()), jobRecordSizeDist.getInnerMetric()); Assert.assertEquals(jobRecordSizeDist.getContext(), this.context); Assert.assertEquals(jobRecordSizeDist.getName(), RECORD_SIZE_DISTRIBUTION); jobRecordSizeDist.update(2); jobRecordSizeDist.update(4); jobRecordSizeDist.update(7); Assert.assertEquals(jobRecordSizeDist.getCount(), 3l); Assert.assertEquals(jobRecordSizeDist.getSnapshot().getMin(), 2l); Assert.assertEquals(jobRecordSizeDist.getSnapshot().getMax(), 7l); ContextAwareHistogram taskRecordSizeDist = this.childContext.contextAwareHistogram(RECORD_SIZE_DISTRIBUTION); Assert.assertEquals(this.childContext.getHistograms().get(taskRecordSizeDist.getName()), taskRecordSizeDist.getInnerMetric()); Assert.assertEquals(taskRecordSizeDist.getContext(), this.childContext); Assert.assertEquals(taskRecordSizeDist.getName(), RECORD_SIZE_DISTRIBUTION); taskRecordSizeDist.update(3); taskRecordSizeDist.update(14); taskRecordSizeDist.update(11); Assert.assertEquals(taskRecordSizeDist.getCount(), 3l); Assert.assertEquals(taskRecordSizeDist.getSnapshot().getMin(), 3l); Assert.assertEquals(taskRecordSizeDist.getSnapshot().getMax(), 14l); Assert.assertEquals(jobRecordSizeDist.getCount(), 6l); Assert.assertEquals(jobRecordSizeDist.getSnapshot().getMin(), 2l); Assert.assertEquals(jobRecordSizeDist.getSnapshot().getMax(), 14l); }
WeakReference<ContextAwareMeter> meterWeakReference = new WeakReference<ContextAwareMeter>(meter); meter.mark(); ContextAwareHistogram histogram = metricContext.contextAwareHistogram("testHistogram"); WeakReference<ContextAwareHistogram> histogramWeakReference = new WeakReference<ContextAwareHistogram>(histogram); ContextAwareTimer timer = metricContext.contextAwareTimer("testTimer");
/** * This is equivalent to {@link #contextAwareHistogram(String)}. */ @Override public Histogram histogram(String name) { return contextAwareHistogram(name); }
public Metrics(final MetricContext metricContext, Config config) { int timeWindowSizeInMinutes = ConfigUtils.getInt(config, ConfigurationKeys.METRIC_TIMER_WINDOW_SIZE_IN_MINUTES, ConfigurationKeys.DEFAULT_METRIC_TIMER_WINDOW_SIZE_IN_MINUTES); this.serviceLeadershipChange = metricContext.contextAwareHistogram(SERVICE_LEADERSHIP_CHANGE, timeWindowSizeInMinutes, TimeUnit.MINUTES); this.contextAwareMetrics.add(this.serviceLeadershipChange); } }
public HelixManagerMetrics(final MetricContext metricContext, final Config config) { int timeWindowSizeInMinutes = ConfigUtils.getInt(config, ConfigurationKeys.METRIC_TIMER_WINDOW_SIZE_IN_MINUTES, ConfigurationKeys.DEFAULT_METRIC_TIMER_WINDOW_SIZE_IN_MINUTES); this.clusterLeadershipChange = metricContext.contextAwareHistogram(CLUSTER_LEADERSHIP_CHANGE, timeWindowSizeInMinutes, TimeUnit.MINUTES); this.contextAwareMetrics.add(clusterLeadershipChange); }
InnerHistogram(MetricContext context, String name, ContextAwareHistogram contextAwareHistogram) { super(new ExponentiallyDecayingReservoir()); this.name = name; Optional<MetricContext> parentContext = context.getParent(); if (parentContext.isPresent()) { this.parentHistogram = Optional.fromNullable(parentContext.get().contextAwareHistogram(name)); } else { this.parentHistogram = Optional.absent(); } this.contextAwareHistogram = new WeakReference<>(contextAwareHistogram); }
InnerHistogram(MetricContext context, String name, ContextAwareHistogram contextAwareHistogram, long windowSize, TimeUnit unit) { super(new SlidingTimeWindowReservoir(windowSize, unit)); this.name = name; Optional<MetricContext> parentContext = context.getParent(); if (parentContext.isPresent()) { this.parentHistogram = Optional.fromNullable(parentContext.get().contextAwareHistogram(name, windowSize, unit)); } else { this.parentHistogram = Optional.absent(); } this.contextAwareHistogram = new WeakReference<>(contextAwareHistogram); }
Meter recordProcessRateMeter = this.context.contextAwareMeter(RECORD_PROCESS_RATE); Timer recordProcessTimeTimer = this.context.contextAwareTimer(RECORD_PROCESS_TIME); Histogram recordSizesHistogram = this.context.contextAwareHistogram(RECORD_SIZES);