@Override public long getCount() { return dropwizardHistogram.getCount(); }
@Override public long getCount() { return histogram.getCount(); }
public void writeValues(Histogram histogram, JsonGenerator jg) throws IOException { final Snapshot snapshot = histogram.getSnapshot(); jg.writeNumberField("count", histogram.getCount()); writeHistogramSnapshot(snapshot, jg); } }
private void printHistogram(String name, Histogram histogram, int maxNameLength, StringBuilder sb) { sb.append(String.format("%" + maxNameLength + "s | ", name)); sb.append(formatCount(histogram.getCount())); printHistogramSnapshot(histogram.getSnapshot(), sb); sb.append('\n'); }
private void reportHistogram(JsonGenerator json, String name, Histogram histogram) throws IOException { Snapshot snapshot = histogram.getSnapshot(); json.writeFieldName(sanitize(name)); json.writeStartObject(); json.writeNumberField("count", histogram.getCount()); writeSnapshot(json, snapshot); json.writeEndObject(); }
/** * Convert histogram snapshot. */ private SummaryMetricFamily fromHistogram(List<Map.Entry<MetricName, Histogram>> histogramsWithSameName) { final SummaryMetricFamily summaryMetricFamily = getSummaryMetricFamily(histogramsWithSameName, ""); for (Map.Entry<MetricName, Histogram> entry : histogramsWithSameName) { addSummaryMetric(summaryMetricFamily, entry.getKey(), entry.getValue().getSnapshot(), 1.0D, entry.getValue().getCount()); } return summaryMetricFamily; }
@Override protected void reportInContext(MetricContext context, SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { for (Map.Entry<String, Gauge> entry : gauges.entrySet()) { Gauge gauge = entry.getValue(); if (gauge.getValue() instanceof Long || gauge.getValue() instanceof Integer || gauge.getValue() instanceof Short || gauge.getValue() instanceof Byte) reportValue(context, entry.getKey(), ((Number) gauge.getValue()).longValue()); } for (Map.Entry<String, Counter> entry : counters.entrySet()) { reportCount(context, entry.getKey(), entry.getValue().getCount()); } for (Map.Entry<String, Meter> entry : meters.entrySet()) { reportCount(context, entry.getKey(), entry.getValue().getCount()); } for (Map.Entry<String, Histogram> entry : histograms.entrySet()) { reportCount(context, entry.getKey(), entry.getValue().getCount()); } for (Map.Entry<String, Timer> entry : timers.entrySet()) { reportCount(context, entry.getKey(), entry.getValue().getCount()); } }
private void reportHistograms(Map<MetricName, Histogram> histograms, long timestamp) { for (Map.Entry<MetricName, Histogram> entry : histograms.entrySet()) { final Histogram hist = entry.getValue(); final Snapshot snapshot = hist.getSnapshot(); reportLine(getInfluxDbLineProtocolString(entry.getKey()), "count=" + getIntegerValue(hist.getCount()) + "," + reportHistogramSnapshot(snapshot), timestamp); } }
private void printHistogram(Histogram histogram) { Snapshot snapshot = histogram.getSnapshot(); output.printf(locale, " min = %d%n", snapshot.getMin()); output.printf(locale, " max = %d%n", snapshot.getMax()); output.printf(locale, " mean = %2.2f%n", snapshot.getMean()); output.printf(locale, " stddev = %2.2f%n", snapshot.getStdDev()); output.printf(locale, " median = %2.2f%n", snapshot.getMedian()); output.printf(locale, " 75%% <= %2.2f%n", snapshot.get75thPercentile()); output.printf(locale, " 95%% <= %2.2f%n", snapshot.get95thPercentile()); output.printf(locale, " 98%% <= %2.2f%n", snapshot.get98thPercentile()); output.printf(locale, " 99%% <= %2.2f%n", snapshot.get99thPercentile()); output.printf(locale, " 99.9%% <= %2.2f%n", snapshot.get999thPercentile()); output.printf(locale, " count = %d%n", histogram.getCount()); } }
private void printHistogram(Histogram histogram) { this.outputBufferPrintStream.printf(locale, " count = %d%n", histogram.getCount()); Snapshot snapshot = histogram.getSnapshot(); this.outputBufferPrintStream.printf(locale, " min = %d%n", snapshot.getMin()); this.outputBufferPrintStream.printf(locale, " max = %d%n", snapshot.getMax()); this.outputBufferPrintStream.printf(locale, " mean = %2.2f%n", snapshot.getMean()); this.outputBufferPrintStream.printf(locale, " stddev = %2.2f%n", snapshot.getStdDev()); this.outputBufferPrintStream.printf(locale, " median = %2.2f%n", snapshot.getMedian()); this.outputBufferPrintStream.printf(locale, " 75%% <= %2.2f%n", snapshot.get75thPercentile()); this.outputBufferPrintStream.printf(locale, " 95%% <= %2.2f%n", snapshot.get95thPercentile()); this.outputBufferPrintStream.printf(locale, " 98%% <= %2.2f%n", snapshot.get98thPercentile()); this.outputBufferPrintStream.printf(locale, " 99%% <= %2.2f%n", snapshot.get99thPercentile()); this.outputBufferPrintStream.printf(locale, " 99.9%% <= %2.2f%n", snapshot.get999thPercentile()); }
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; }
public static Histogram histogram(long count, Snapshot snapshot) { final Histogram histogram = mock(Histogram.class); when(histogram.getCount()).thenReturn(count); when(histogram.getSnapshot()).thenReturn(snapshot); return histogram; }
private void printHistogram(Histogram histogram) { printIfEnabled(MetricAttribute.COUNT, String.format(locale, " count = %d", histogram.getCount())); Snapshot snapshot = histogram.getSnapshot(); printIfEnabled(MetricAttribute.MIN, String.format(locale, " min = %d", snapshot.getMin())); printIfEnabled(MetricAttribute.MAX, String.format(locale, " max = %d", snapshot.getMax())); printIfEnabled(MetricAttribute.MEAN, String.format(locale, " mean = %2.2f", snapshot.getMean())); printIfEnabled(MetricAttribute.STDDEV, String.format(locale, " stddev = %2.2f", snapshot.getStdDev())); printIfEnabled(MetricAttribute.P50, String.format(locale, " median = %2.2f", snapshot.getMedian())); printIfEnabled(MetricAttribute.P75, String.format(locale, " 75%% <= %2.2f", snapshot.get75thPercentile())); printIfEnabled(MetricAttribute.P95, String.format(locale, " 95%% <= %2.2f", snapshot.get95thPercentile())); printIfEnabled(MetricAttribute.P98, String.format(locale, " 98%% <= %2.2f", snapshot.get98thPercentile())); printIfEnabled(MetricAttribute.P99, String.format(locale, " 99%% <= %2.2f", snapshot.get99thPercentile())); printIfEnabled(MetricAttribute.P999, String.format(locale, " 99.9%% <= %2.2f", snapshot.get999thPercentile())); }
final Histogram histogram = entry.getValue(); addSnapshot(builder, name, EMPTY_STRING, histogram.getSnapshot(), histogram.getCount());
@Test public void testMultiMetrics() throws Exception { Configuration conf = new Configuration(TEST_UTIL.getConfiguration()); conf.set(MetricsConnection.CLIENT_SIDE_METRICS_ENABLED_KEY, "true"); ConnectionImplementation conn = (ConnectionImplementation) ConnectionFactory.createConnection(conf); try { BufferedMutator mutator = conn.getBufferedMutator(TABLE_NAME); byte[][] keys = {Bytes.toBytes("aaa"), Bytes.toBytes("mmm"), Bytes.toBytes("zzz")}; for (byte[] key : keys) { Put p = new Put(key); p.addColumn(FAMILY, QUALIFIER, Bytes.toBytes(10)); mutator.mutate(p); } mutator.flush(); mutator.close(); MetricsConnection metrics = conn.getConnectionMetrics(); assertEquals(1, metrics.multiTracker.reqHist.getCount()); assertEquals(3, metrics.numActionsPerServerHist.getSnapshot().getMean(), 1e-15); assertEquals(1, metrics.numActionsPerServerHist.getCount()); } finally { conn.close(); } } }
status.setStatus("Latency (us) : " + YammerHistogramUtils.getHistogramReport( latencyHistogram)); status.setStatus("Num measures (latency) : " + latencyHistogram.getCount()); status.setStatus(YammerHistogramUtils.getPrettyHistogramReport(latencyHistogram)); if (valueSizeHistogram.getCount() > 0) { status.setStatus("ValueSize (bytes) : " + YammerHistogramUtils.getHistogramReport(valueSizeHistogram)); status.setStatus("Num measures (ValueSize): " + valueSizeHistogram.getCount()); status.setStatus(YammerHistogramUtils.getPrettyHistogramReport(valueSizeHistogram)); } else { status.setStatus("No valueSize statistics available"); if (rpcCallsHistogram.getCount() > 0) { status.setStatus("rpcCalls (count): " + YammerHistogramUtils.getHistogramReport(rpcCallsHistogram)); if (remoteRpcCallsHistogram.getCount() > 0) { status.setStatus("remoteRpcCalls (count): " + YammerHistogramUtils.getHistogramReport(remoteRpcCallsHistogram)); if (millisBetweenNextHistogram.getCount() > 0) { status.setStatus("millisBetweenNext (latency): " + YammerHistogramUtils.getHistogramReport(millisBetweenNextHistogram)); if (regionsScannedHistogram.getCount() > 0) { status.setStatus("regionsScanned (count): " + YammerHistogramUtils.getHistogramReport(regionsScannedHistogram)); if (bytesInResultsHistogram.getCount() > 0) {
when(snapshot.getStdDev()).thenReturn(stddev); when(histogram.getCount()).thenReturn(count); when(histogram.getSnapshot()).thenReturn(snapshot);
private void reportHistogram(long timestamp, String name, Histogram histogram) { final Snapshot snapshot = histogram.getSnapshot(); report(timestamp, name, "count,max,mean,min,stddev,p50,p75,p95,p98,p99,p999", histogramFormat, histogram.getCount(), snapshot.getMax(), snapshot.getMean(), snapshot.getMin(), snapshot.getStdDev(), snapshot.getMedian(), snapshot.get75thPercentile(), snapshot.get95thPercentile(), snapshot.get98thPercentile(), snapshot.get99thPercentile(), snapshot.get999thPercentile()); }
private void logHistogram(String name, Histogram histogram) { final Snapshot snapshot = histogram.getSnapshot(); loggerProxy.log(marker, "type={}, name={}, count={}, min={}, max={}, mean={}, stddev={}, " + "median={}, p75={}, p95={}, p98={}, p99={}, p999={}", "HISTOGRAM", prefix(name), histogram.getCount(), snapshot.getMin(), snapshot.getMax(), snapshot.getMean(), snapshot.getStdDev(), snapshot.getMedian(), snapshot.get75thPercentile(), snapshot.get95thPercentile(), snapshot.get98thPercentile(), snapshot.get99thPercentile(), snapshot.get999thPercentile()); }