本文整理了Java中com.codahale.metrics.Histogram.getSnapshot()
方法的一些代码示例,展示了Histogram.getSnapshot()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram.getSnapshot()
方法的具体详情如下:
包路径:com.codahale.metrics.Histogram
类名称:Histogram
方法名:getSnapshot
暂无
代码示例来源:origin: apache/flink
@Override
public HistogramStatistics getStatistics() {
return new DropwizardHistogramStatistics(dropwizardHistogram.getSnapshot());
}
}
代码示例来源:origin: apache/zookeeper
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;
}
}
代码示例来源:origin: Graylog2/graylog2-server
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;
}
代码示例来源:origin: stagemonitor/stagemonitor
public void writeValues(Histogram histogram, JsonGenerator jg) throws IOException {
final Snapshot snapshot = histogram.getSnapshot();
jg.writeNumberField("count", histogram.getCount());
writeHistogramSnapshot(snapshot, jg);
}
}
代码示例来源:origin: stagemonitor/stagemonitor
@Override
public int compare(Histogram o1, Histogram o2) {
return Double.compare(o2.getSnapshot().getMean(), o1.getSnapshot().getMean());
}
});
代码示例来源:origin: stagemonitor/stagemonitor
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');
}
代码示例来源:origin: signalapp/Signal-Server
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();
}
代码示例来源:origin: AxonFramework/AxonFramework
@Override
public Double getValue() {
Snapshot snapshot = processedDurationHistogram.getSnapshot();
double meanProcessTime = snapshot.getMean();
int numProcessed = snapshot.getValues().length;
return (numProcessed * meanProcessTime) / timeUnit.toMillis(window);
}
}
代码示例来源:origin: stagemonitor/stagemonitor
/**
* 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;
}
代码示例来源:origin: apache/hbase
/** @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());
}
代码示例来源:origin: apache/incubator-gobblin
private void reportHistogram(List<Point> points, String prefix, String name, Histogram histogram, long timestamp)
throws IOException {
reportCounter(points, prefix, name, histogram, timestamp);
reportSnapshot(points, prefix, name, histogram.getSnapshot(), timestamp, false);
}
代码示例来源:origin: spotify/helios
private void reportHistogram(String name, Histogram histogram) {
final Metric metric = createMetric(name, "histogram");
reportHistogram(metric, histogram.getSnapshot());
}
代码示例来源:origin: apache/incubator-gobblin
private void reportHistogram(String prefix, String name, Histogram histogram, long timestamp) throws IOException {
reportCounter(prefix, name, histogram, timestamp);
reportSnapshot(prefix, name, histogram.getSnapshot(), timestamp, false);
}
代码示例来源:origin: micrometer-metrics/micrometer
@TearDown(Level.Iteration)
public void tearDown(Blackhole hole) {
hole.consume(histogram.getSnapshot().getMedian());
hole.consume(histogramSlidingTimeWindow.getSnapshot().getMedian());
hole.consume(histogramUniform.getSnapshot().getMedian());
}
}
代码示例来源:origin: stagemonitor/stagemonitor
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);
}
}
代码示例来源:origin: apache/hbase
/** @return a summary of {@code hist}. */
public static String getHistogramReport(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()) +
", 50th=" + DOUBLE_FORMAT.format(sn.getMedian()) +
", 75th=" + DOUBLE_FORMAT.format(sn.get75thPercentile()) +
", 95th=" + DOUBLE_FORMAT.format(sn.get95thPercentile()) +
", 99th=" + DOUBLE_FORMAT.format(sn.get99thPercentile()) +
", 99.9th=" + DOUBLE_FORMAT.format(sn.get999thPercentile()) +
", 99.99th=" + DOUBLE_FORMAT.format(sn.getValue(0.9999)) +
", 99.999th=" + DOUBLE_FORMAT.format(sn.getValue(0.99999));
}
代码示例来源:origin: apache/hbase
@Override
double apply(Histogram hist) {
return hist.getSnapshot().getValue(0.9999);
}
};
代码示例来源:origin: apache/hbase
@Override
double apply(Histogram hist) {
return hist.getSnapshot().getStdDev();
}
},
代码示例来源:origin: stagemonitor/stagemonitor
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;
}
代码示例来源:origin: alibaba/jstorm
public static Histogram metricSnapshot2Histogram(MetricSnapshot snapshot) {
Histogram histogram;
if (metricAccurateCal) {
histogram = new Histogram(new ExponentiallyDecayingReservoir());
byte[] points = snapshot.get_points();
int len = snapshot.get_pointSize();
updateHistogramPoints(histogram, points, len);
} else {
histogram = new Histogram(new JAverageReservoir());
JAverageSnapshot averageSnapshot = (JAverageSnapshot) histogram.getSnapshot();
averageSnapshot.setMetricSnapshot(snapshot.deepCopy());
}
return histogram;
}
内容来源于网络,如有侵权,请联系作者删除!