本文整理了Java中com.codahale.metrics.Histogram.getCount()
方法的一些代码示例,展示了Histogram.getCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram.getCount()
方法的具体详情如下:
包路径:com.codahale.metrics.Histogram
类名称:Histogram
方法名:getCount
[英]Returns the number of values recorded.
[中]返回记录的值的数目。
代码示例来源:origin: apache/flink
@Override
public long getCount() {
return dropwizardHistogram.getCount();
}
代码示例来源:origin: io.dropwizard.metrics/metrics-core
@Override
public long getCount() {
return histogram.getCount();
}
代码示例来源: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
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: 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/incubator-gobblin
@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());
}
}
代码示例来源: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
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());
}
}
代码示例来源:origin: apache/incubator-gobblin
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());
}
代码示例来源: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 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: io.dropwizard.metrics/metrics-core
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()));
}
代码示例来源:origin: apache/kylin
final Histogram histogram = entry.getValue();
addSnapshot(builder, name, EMPTY_STRING, histogram.getSnapshot(), histogram.getCount());
代码示例来源:origin: apache/hbase
@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();
}
}
}
代码示例来源:origin: apache/hbase
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) {
代码示例来源:origin: apache/kylin
when(snapshot.getStdDev()).thenReturn(stddev);
when(histogram.getCount()).thenReturn(count);
when(histogram.getSnapshot()).thenReturn(snapshot);
代码示例来源:origin: io.dropwizard.metrics/metrics-core
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());
}
代码示例来源:origin: io.dropwizard.metrics/metrics-core
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());
}
代码示例来源:origin: apache/hbase
}) {
assertEquals("Failed to invoke callTimer on " + t, loop, t.callTimer.getCount());
assertEquals("Failed to invoke reqHist on " + t, loop, t.reqHist.getCount());
assertEquals("Failed to invoke respHist on " + t, loop, t.respHist.getCount());
内容来源于网络,如有侵权,请联系作者删除!