Refine search
private String reportHistogramSnapshot(Snapshot snapshot) { return "min=" + snapshot.getMin() + "," + "max=" + snapshot.getMax() + "," + "mean=" + snapshot.getMean() + "," + "p50=" + snapshot.getMedian() + "," + "std=" + snapshot.getStdDev() + "," + "p25=" + snapshot.getValue(0.25) + "," + "p75=" + snapshot.get75thPercentile() + "," + "p95=" + snapshot.get95thPercentile() + "," + "p98=" + snapshot.get98thPercentile() + "," + "p99=" + snapshot.get99thPercentile() + "," + "p999=" + snapshot.get999thPercentile(); }
/** @return an abbreviated summary of {@code hist}. */ public static String getShortHistogramReport(final Histogram hist) { Snapshot sn = hist.getSnapshot(); return "mean=" + DOUBLE_FORMAT.format(sn.getMean()) + ", min=" + DOUBLE_FORMAT.format(sn.getMin()) + ", max=" + DOUBLE_FORMAT.format(sn.getMax()) + ", stdDev=" + DOUBLE_FORMAT.format(sn.getStdDev()) + ", 95th=" + DOUBLE_FORMAT.format(sn.get95thPercentile()) + ", 99th=" + DOUBLE_FORMAT.format(sn.get99thPercentile()); }
public Map<String, Object> values() { Map<String, Object> m = new LinkedHashMap<>(); m.putAll(counter.values()); m.put("p50_" + name, Math.round(this.histogram.getSnapshot().getMedian())); m.put("p95_" + name, Math.round(this.histogram.getSnapshot().get95thPercentile())); m.put("p99_" + name, Math.round(this.histogram.getSnapshot().get99thPercentile())); m.put("p999_" + name, Math.round(this.histogram.getSnapshot().get999thPercentile())); return m; } }
@Test public void shouldUpdateMeanMetric() { double newMean = INITIAL_MEAN + 5; when(snapshot.getMean()).thenReturn(newMean); adapter.updateMonitorables(); assertThat(extractMonitorables(adapter).get(MEAN).get(), Matchers.<Object>is(newMean)); }
@Test public void shouldUpdateMaxMetric() { long newMax = INITIAL_MAX + 10; when(snapshot.getMax()).thenReturn(newMax); timerAdapter.updateMonitorables(); assertThat(extractMonitorables(timerAdapter).get(MAX).get(), Matchers.<Object>is(newMax)); }
@Test public void shouldUpdateMinMetric() { long newMin = INITIAL_MIN - 5; when(snapshot.getMin()).thenReturn(newMin); adapter.updateMonitorables(); assertThat(extractMonitorables(adapter).get(MIN).get(), Matchers.<Object>is(newMin)); }
@Test public void shouldUpdateMedianMetric() { double newMedian = INITIAL_MEDIAN + 5; when(snapshot.getMedian()).thenReturn(newMedian); adapter.updateMonitorables(); assertThat(extractMonitorables(adapter).get(MEDIAN).get(), Matchers.<Object>is(newMedian)); }
@Test public void shouldUpdateStdDevMetric() { double newStdDev = INITIAL_STDDEV + 5; when(snapshot.getStdDev()).thenReturn(newStdDev); adapter.updateMonitorables(); assertThat(extractMonitorables(adapter).get(STDDEV).get(), Matchers.<Object>is(newStdDev)); }
@Before public void setUp() { when(histogram.getSnapshot()).thenReturn(snapshot); when(snapshot.getMax()).thenReturn(INITIAL_MAX); when(snapshot.getMin()).thenReturn(INITIAL_MIN); when(snapshot.getMedian()).thenReturn(INITIAL_MEDIAN); when(snapshot.getMean()).thenReturn(INITIAL_MEAN); when(snapshot.getStdDev()).thenReturn(INITIAL_STDDEV); when(histogram.getCount()).thenReturn(INITIAL_COUNT); histogramAdapter = new HistogramAdapter(histogram, NAME, DESCRIPTION); }
@Test public void shouldUpdate99thMetric() { double new99thMetric = INITIAL_99th + 5; when(snapshot.get99thPercentile()).thenReturn(new99thMetric); adapter.updateMonitorables(); assertThat(extractMonitorables(adapter).get(NINETY_NINETH).get(), Matchers.<Object>is(new99thMetric)); }
@Test public void shouldUpdate95thMetric() { double new95thMetric = INITIAL_95th + 5; when(snapshot.get95thPercentile()).thenReturn(new95thMetric); adapter.updateMonitorables(); assertThat(extractMonitorables(adapter).get(NINETY_FIFTH).get(), Matchers.<Object>is(new95thMetric)); }
@Test public void shouldUpdate999thMetric() { double new999thMetric = INITIAL_THREE_NINES + 5; when(snapshot.get999thPercentile()).thenReturn(new999thMetric); adapter.updateMonitorables(); assertThat(extractMonitorables(adapter).get(THREE_NINES).get(), Matchers.<Object>is(new999thMetric)); }
@Test public void shouldUpdate75thMetric() { double new75thMetric = INITIAL_75th + 5; when(snapshot.get75thPercentile()).thenReturn(new75thMetric); adapter.updateMonitorables(); assertThat(extractMonitorables(adapter).get(SEVENTY_FIFTH).get(), Matchers.<Object>is(new75thMetric)); }
@Test public void shouldUpdate98thMetric() { double new98thMetric = INITIAL_98th + 5; when(snapshot.get98thPercentile()).thenReturn(new98thMetric); adapter.updateMonitorables(); assertThat(extractMonitorables(adapter).get(NINETY_EIGHTH).get(), Matchers.<Object>is(new98thMetric)); }
@Test public void aTimedAnnotatedMethod() throws Exception { instance.doAThing(); final Timer metric = registry.getTimers().get(name(InstrumentedWithTimed.class, "things")); assertMetricSetup(metric); assertThat("Guice creates a timer which records invocation length", metric.getCount(), is(1L)); assertThat("Guice creates a timer which records invocation duration without underestimating too much", metric.getSnapshot().getMax(), is(greaterThan(NANOSECONDS.convert(5, MILLISECONDS)))); assertThat("Guice creates a timer which records invocation duration without overestimating too much", metric.getSnapshot().getMax(), is(lessThan(NANOSECONDS.convert(15, MILLISECONDS)))); }
public static Map<String, Object> buildHistogramMap(Histogram h) { Map<String, Object> metrics = Maps.newHashMap(); if (h == null) { return metrics; } Map<String, Object> time = Maps.newHashMap(); time.put("max", h.getSnapshot().getMax()); time.put("min", h.getSnapshot().getMin()); time.put("mean", (long) h.getSnapshot().getMean()); time.put("95th_percentile", (long) h.getSnapshot().get95thPercentile()); time.put("98th_percentile", (long) h.getSnapshot().get98thPercentile()); time.put("99th_percentile", (long) h.getSnapshot().get99thPercentile()); time.put("std_dev", (long) h.getSnapshot().getStdDev()); metrics.put("time", time); metrics.put("count", h.getCount()); return metrics; }
private void reportHistogram(Metric metric, Snapshot snapshot) { send(metric.attribute("stat", "min").value(snapshot.getMin())); send(metric.attribute("stat", "max").value(snapshot.getMax())); send(metric.attribute("stat", "mean").value(snapshot.getMean())); send(metric.attribute("stat", "stddev").value(snapshot.getStdDev())); send(metric.attribute("stat", "median").value(snapshot.getMedian())); send(metric.attribute("stat", "p75").value(snapshot.get75thPercentile())); send(metric.attribute("stat", "p99").value(snapshot.get99thPercentile())); }
private void addSummaryMetric(SummaryMetricFamily summaryMetricFamily, MetricName name, Snapshot snapshot, double conversionFactor, long count) { summaryMetricFamily.addMetric(name.getTagValues(), count, -1, Arrays.asList(snapshot.getMedian() / conversionFactor, snapshot.get75thPercentile() / conversionFactor, snapshot.get95thPercentile() / conversionFactor, snapshot.get98thPercentile() / conversionFactor, snapshot.get99thPercentile() / conversionFactor, snapshot.get999thPercentile() / conversionFactor)); }
metrics.getTrashedConnections().getValue())); Snapshot snapshot = metrics.getRequestsTimer().getSnapshot(); prefix = prefix + ".requests_timer"; ret.add(newDataPointSet(prefix, "max", now, snapshot.getMax())); snapshot.getMin())); snapshot.getMean())); snapshot.size()));
.histogram(HISTOGRAM_NAME).getSnapshot(); "[motan-accessStatistic] app: {} module: {} item: {} total_count: {} slow_count: {} p75: {} p95: {} p98: {} p99: {} p999: {} biz_excp: {} other_excp: {} avg_time: {}ms biz_time: {}ms avg_tps: {} max_tps: {} min_tps: {} ", application, module, keys[0], result.totalCount, result.slowCount, mbFormat.format(snapshot.get75thPercentile()), mbFormat.format(snapshot.get95thPercentile()), mbFormat.format(snapshot.get98thPercentile()), mbFormat.format(snapshot.get99thPercentile()), mbFormat.format(snapshot.get999thPercentile()), result.bizExceptionCount, result.otherExceptionCount, mbFormat.format(result.costTime / result.totalCount), mbFormat.format(result.bizTime / result.totalCount), (result.totalCount / MotanConstants.STATISTIC_PEROID), result.maxCount, result.minCount); Snapshot snapshot = InternalMetricsFactory.getRegistryInstance(entry.getKey()) .histogram(HISTOGRAM_NAME).getSnapshot(); if (totalResult.totalCount > 0) { LoggerUtil.accessStatsLog( "[motan-totalAccessStatistic] app: {} module: {} total_count: {} slow_count: {} p75: {} p95: {} p98: {} p99: {} p999: {} biz_excp: {} other_excp: {} avg_time: {}ms biz_time: {}ms avg_tps: {}", application, module, totalResult.totalCount, totalResult.slowCount, mbFormat.format(snapshot.get75thPercentile()), mbFormat.format(snapshot.get95thPercentile()), mbFormat.format(snapshot.get98thPercentile()), mbFormat.format(snapshot.get99thPercentile()), mbFormat.format(snapshot.get999thPercentile()), totalResult.bizExceptionCount, totalResult.otherExceptionCount, mbFormat.format(totalResult.costTime / totalResult.totalCount), mbFormat.format(totalResult.bizTime / totalResult.totalCount),