@Override public MaxGauge newInstance(String name) { return new MaxGauge(MonitorConfig.builder(name).build(), clock); }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof BucketTimer)) { return false; } BucketTimer m = (BucketTimer) obj; return config.equals(m.getConfig()) && bucketConfig.equals(m.bucketConfig) && timeUnit.equals(m.timeUnit) && totalTime.equals(m.totalTime) && min.equals(m.min) && max.equals(m.max) && overflowCount.equals(m.overflowCount) && Arrays.equals(bucketCount, m.bucketCount); }
/** * Updates the statistics kept by the summary with the specified amount. */ public void record(long amount) { if (amount >= 0) { totalAmount.increment(amount); count.increment(); max.update(amount); min.update(amount); } }
/** * Get the max value since the last reset. */ public Long getMax(int pollerIndex) { return max.getValue(pollerIndex); }
/** * {@inheritDoc} */ @Override public int hashCode() { int result = config.hashCode(); result = 31 * result + timeUnit.hashCode(); result = 31 * result + totalTime.hashCode(); result = 31 * result + Arrays.hashCode(bucketCount); result = 31 * result + overflowCount.hashCode(); result = 31 * result + min.hashCode(); result = 31 * result + max.hashCode(); result = 31 * result + bucketConfig.hashCode(); return result; }
/** * Update the max if the provided value is larger than the current max. */ public void update(long v) { spectatorGauge.set(v); for (int i = 0; i < Pollers.NUM_POLLERS; ++i) { updateMax(i, v); } }
/** * {@inheritDoc} */ @Override public void initializeSpectator(TagList tags) { totalAmount.initializeSpectator(BasicTagList.concat(tags, STAT_TOTAL)); count.initializeSpectator(BasicTagList.concat(tags, STAT_COUNT)); max.initializeSpectator(BasicTagList.concat(tags, STAT_MAX)); }
/** * Get the max value since the last polling interval. */ public Long getMax() { return max.getCurrentValue(0); }
/** * {@inheritDoc} */ @Override public void record(long duration) { totalTime.increment(duration); min.update(duration); max.update(duration); final long[] buckets = bucketConfig.getBuckets(); final long bucketDuration = bucketConfig.getTimeUnit().convert(duration, timeUnit); for (int i = 0; i < buckets.length; i++) { if (bucketDuration <= buckets[i]) { bucketCount[i].increment(); return; } } overflowCount.increment(); }
/** * Get the max value since the last reset. */ public Long getMax(int pollerIndex) { return max.getValue(pollerIndex); }
/** * {@inheritDoc} */ @Override public int hashCode() { int result = config.hashCode(); result = 31 * result + totalAmount.hashCode(); result = 31 * result + count.hashCode(); result = 31 * result + max.hashCode(); result = 31 * result + min.hashCode(); return result; }
/** * Update the max if the provided value is larger than the current max. */ public void update(long v) { spectatorGauge.set(v); for (int i = 0; i < Pollers.NUM_POLLERS; ++i) { updateMax(i, v); } }
/** * {@inheritDoc} */ @Override public void initializeSpectator(TagList tags) { totalAmount.initializeSpectator(BasicTagList.concat(tags, STAT_TOTAL)); count.initializeSpectator(BasicTagList.concat(tags, STAT_COUNT)); max.initializeSpectator(BasicTagList.concat(tags, STAT_MAX)); }
/** * Get the max value since the last polling interval. */ public Long getMax() { return max.getCurrentValue(0); }
.withAdditionalTag(Tags.newTag(BUCKET, "bucket=overflow"))); this.min = new MinGauge(unitConfig.withAdditionalTag(STAT_MIN), clock); this.max = new MaxGauge(unitConfig.withAdditionalTag(STAT_MAX), clock);
@Override public void set(double v) { impl.update((long) v); lastUpdated.set(clock.wallTime()); }