本文整理匯總了Java中com.yammer.metrics.stats.Snapshot類的典型用法代碼示例。如果您正苦於以下問題:Java Snapshot類的具體用法?Java Snapshot怎麽用?Java Snapshot使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Snapshot類屬於com.yammer.metrics.stats包,在下文中一共展示了Snapshot類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processHistogram
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
@Override
public void processHistogram(MetricName metricName, Histogram histogram, Context context) throws Exception {
final Snapshot snapshot = histogram.getSnapshot();
Point.Builder pointbuilder = buildMetricsPointByMetricName(metricName, context);
pointbuilder.tag("metric_type", "histogram");
pointbuilder.addField("max", histogram.max());
pointbuilder.addField("mean", histogram.mean());
pointbuilder.addField("min", histogram.min());
pointbuilder.addField("stddev", histogram.max());
pointbuilder.addField("sum", histogram.sum());
pointbuilder.addField("median", snapshot.getMedian());
pointbuilder.addField("p75", snapshot.get75thPercentile());
pointbuilder.addField("p95", snapshot.get95thPercentile());
pointbuilder.addField("p98", snapshot.get98thPercentile());
pointbuilder.addField("p99", snapshot.get99thPercentile());
pointbuilder.addField("p999", snapshot.get999thPercentile());
addPoint(pointbuilder.build());
}
示例2: updateSnapshotMetrics
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
public void updateSnapshotMetrics(MetricsRecordBuilder metricsRecordBuilder) {
final Snapshot s = sample.getSnapshot();
metricsRecordBuilder.addCounter(Interns.info(name + NUM_OPS_METRIC_NAME, desc), count.get());
metricsRecordBuilder.addGauge(Interns.info(name + MIN_METRIC_NAME, desc), getMin());
metricsRecordBuilder.addGauge(Interns.info(name + MAX_METRIC_NAME, desc), getMax());
metricsRecordBuilder.addGauge(Interns.info(name + MEAN_METRIC_NAME, desc), getMean());
metricsRecordBuilder.addGauge(Interns.info(name + MEDIAN_METRIC_NAME, desc), s.getMedian());
metricsRecordBuilder.addGauge(Interns.info(name + SEVENTY_FIFTH_PERCENTILE_METRIC_NAME, desc),
s.get75thPercentile());
metricsRecordBuilder.addGauge(Interns.info(name + NINETIETH_PERCENTILE_METRIC_NAME, desc),
s.getValue(0.90));
metricsRecordBuilder.addGauge(Interns.info(name + NINETY_FIFTH_PERCENTILE_METRIC_NAME, desc),
s.get95thPercentile());
metricsRecordBuilder.addGauge(Interns.info(name + NINETY_NINETH_PERCENTILE_METRIC_NAME, desc),
s.get99thPercentile());
}
示例3: pushMetric
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
@Override
public void pushMetric(MetricsRecord mr) {
final Snapshot s = this.getSnapshot();
mr.setMetric(getName() + NUM_OPS_METRIC_NAME, this.getCount());
mr.setMetric(getName() + MIN_METRIC_NAME, this.getMin());
mr.setMetric(getName() + MAX_METRIC_NAME, this.getMax());
mr.setMetric(getName() + MEAN_METRIC_NAME, (float) this.getMean());
mr.setMetric(getName() + STD_DEV_METRIC_NAME, (float) this.getStdDev());
mr.setMetric(getName() + MEDIAN_METRIC_NAME, (float) s.getMedian());
mr.setMetric(getName() + SEVENTY_FIFTH_PERCENTILE_METRIC_NAME,
(float) s.get75thPercentile());
mr.setMetric(getName() + NINETY_FIFTH_PERCENTILE_METRIC_NAME,
(float) s.get95thPercentile());
mr.setMetric(getName() + NINETY_NINETH_PERCENTILE_METRIC_NAME,
(float) s.get99thPercentile());
}
示例4: appendHistogram
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
private StringBuilder appendHistogram(StringBuilder sb,
MetricsHistogram histogram) {
sb = Strings.appendKeyValue(sb,
histogram.getName() + "Mean",
StringUtils.limitDecimalTo2(histogram.getMean()));
sb = Strings.appendKeyValue(sb,
histogram.getName() + "Count",
StringUtils.limitDecimalTo2(histogram.getCount()));
final Snapshot s = histogram.getSnapshot();
sb = Strings.appendKeyValue(sb,
histogram.getName() + "Median",
StringUtils.limitDecimalTo2(s.getMedian()));
sb = Strings.appendKeyValue(sb,
histogram.getName() + "75th",
StringUtils.limitDecimalTo2(s.get75thPercentile()));
sb = Strings.appendKeyValue(sb,
histogram.getName() + "95th",
StringUtils.limitDecimalTo2(s.get95thPercentile()));
sb = Strings.appendKeyValue(sb,
histogram.getName() + "99th",
StringUtils.limitDecimalTo2(s.get99thPercentile()));
sb = Strings.appendKeyValue(sb,
histogram.getName() + "999th",
StringUtils.limitDecimalTo2(s.get999thPercentile()));
return sb;
}
示例5: processHistogram
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
@Override
public void processHistogram(final MetricName name,
final Histogram histogram, final PrintStream stream) {
final Snapshot snapshot = histogram.getSnapshot();
stream.printf(locale, " min = %,2.2f\n", histogram.min());
stream.printf(locale, " max = %,2.2f\n", histogram.max());
stream.printf(locale, " mean = %,2.2f\n", histogram.mean());
stream.printf(locale, " stddev = %,2.2f\n",
histogram.stdDev());
stream.printf(locale, " median = %,2.2f\n",
snapshot.getMedian());
stream.printf(locale, " 75%% <= %,2.2f\n",
snapshot.get75thPercentile());
stream.printf(locale, " 95%% <= %,2.2f\n",
snapshot.get95thPercentile());
stream.printf(locale, " 98%% <= %,2.2f\n",
snapshot.get98thPercentile());
stream.printf(locale, " 99%% <= %,2.2f\n",
snapshot.get99thPercentile());
stream.printf(locale, " 99.9%% <= %,2.2f\n",
snapshot.get999thPercentile());
}
示例6: tallyAverages
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
/**
* Collect interval_op_rate and interval_key_rate averages
*/
private void tallyAverages(int totalOperations, int intervalOpRate,
int intervalKeyRate, Snapshot latency,
long currentTimeInSeconds)
{
//Skip the first and last 10% of values.
//The middle values of the operation are the ones worthwhile
//to collect and average:
if (totalOperations > (0.10 * client.getNumKeys()) &&
totalOperations < (0.90 * client.getNumKeys())) {
tallyOpRateSum += intervalOpRate;
tallyOpRateCount += 1;
tallyKeyRateSum += intervalKeyRate;
tallyKeyRateCount += 1;
tallyLatencySum += nanosToMillis(latency.getMedian());
tallyLatencyCount += 1;
tally95thLatencySum += nanosToMillis(latency.get95thPercentile());
tally95thLatencyCount += 1;
tally999thLatencySum += nanosToMillis(latency.get999thPercentile());
tally999thLatencyCount += 1;
}
durationInSeconds = currentTimeInSeconds;
}
示例7: snapshot
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
@Override
public void snapshot(MetricsRecordBuilder metricsRecordBuilder, boolean all) {
if (all || changed()) {
clearChanged();
final Snapshot s = sample.getSnapshot();
metricsRecordBuilder.addCounter(Interns.info(name + NUM_OPS_METRIC_NAME, desc), count.get());
metricsRecordBuilder.addGauge(Interns.info(name + MIN_METRIC_NAME, desc), getMin());
metricsRecordBuilder.addGauge(Interns.info(name + MAX_METRIC_NAME, desc), getMax());
metricsRecordBuilder.addGauge(Interns.info(name + MEAN_METRIC_NAME, desc), getMean());
metricsRecordBuilder.addGauge(Interns.info(name + MEDIAN_METRIC_NAME, desc), s.getMedian());
metricsRecordBuilder.addGauge(Interns.info(name + SEVENTY_FIFTH_PERCENTILE_METRIC_NAME, desc),
s.get75thPercentile());
metricsRecordBuilder.addGauge(Interns.info(name + NINETY_FIFTH_PERCENTILE_METRIC_NAME, desc),
s.get95thPercentile());
metricsRecordBuilder.addGauge(Interns.info(name + NINETY_NINETH_PERCENTILE_METRIC_NAME, desc),
s.get99thPercentile());
}
}
示例8: LatencyMetric
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
public LatencyMetric(T h) {
Snapshot s = h.getSnapshot();
_min = h.min();
_max = h.max();
_mean = h.mean();
if (null != s) {
_percentile95 = s.get95thPercentile();
_percentile99 = s.get99thPercentile();
_percentile999 = s.get999thPercentile();
} else {
_percentile95 = -1;
_percentile99 = -1;
_percentile999 = -1;
}
_histogram = h;
}
示例9: snapshot
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
@Override
public void snapshot(MetricsRecordBuilder metricsRecordBuilder, boolean all) {
if (all || changed()) {
clearChanged();
final Snapshot s = sample.getSnapshot();
metricsRecordBuilder.addCounter(name + NUM_OPS_METRIC_NAME, "", count.get());
metricsRecordBuilder.addGauge(name + MIN_METRIC_NAME, "", getMin());
metricsRecordBuilder.addGauge(name + MAX_METRIC_NAME, "", getMax());
metricsRecordBuilder.addGauge(name + MEAN_METRIC_NAME, "", getMean());
metricsRecordBuilder.addGauge(name + MEDIAN_METRIC_NAME, "", s.getMedian());
metricsRecordBuilder.addGauge(name + SEVENTY_FIFTH_PERCENTILE_METRIC_NAME, "", s.get75thPercentile());
metricsRecordBuilder.addGauge(name + NINETY_FIFTH_PERCENTILE_METRIC_NAME, "", s.get95thPercentile());
metricsRecordBuilder.addGauge(name + NINETY_NINETH_PERCENTILE_METRIC_NAME, "", s.get99thPercentile());
}
}
示例10: processHistogram
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
@Override
public void processHistogram(final MetricName name,
final com.yammer.metrics.core.Histogram histogram,
final Object context) throws Exception {
final Snapshot snapshot = histogram.getSnapshot();
createOrSetGauge(name, "75thPercentile", snapshot.get75thPercentile());
createOrSetGauge(name, "95thPercentile", snapshot.get95thPercentile());
createOrSetGauge(name, "99thPercentile", snapshot.get99thPercentile());
createOrSetGauge(name, "median", snapshot.getMedian());
createOrSetGauge(name, "min", histogram.min());
createOrSetGauge(name, "max", histogram.max());
createOrSetGauge(name, "stdDev", histogram.stdDev());
}
示例11: sendSampling
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
@Override
protected void sendSampling(long epoch, String sanitizedName, Sampling metric) throws IOException {
final Snapshot snapshot = metric.getSnapshot();
if (dimensions.contains(median))
sendFloat(epoch, sanitizedName, "median", snapshot.getMedian());
if (dimensions.contains(p75))
sendFloat(epoch, sanitizedName, "75percentile", snapshot.get75thPercentile());
if (dimensions.contains(p95))
sendFloat(epoch, sanitizedName, "95percentile", snapshot.get95thPercentile());
if (dimensions.contains(p98))
sendFloat(epoch, sanitizedName, "98percentile", snapshot.get98thPercentile());
if (dimensions.contains(p99))
sendFloat(epoch, sanitizedName, "99percentile", snapshot.get99thPercentile());
if (dimensions.contains(p999))
sendFloat(epoch, sanitizedName, "999percentile", snapshot.get999thPercentile());
}
示例12: reportLatency
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
/**
* report percentiles of latency
* @throws IOException
*/
private void reportLatency() throws IOException {
status.setStatus(testName + " latency log (microseconds), on " +
latency.count() + " measures");
Snapshot sn = latency.getSnapshot();
status.setStatus(testName + " Min = " + latency.min());
status.setStatus(testName + " Avg = " + latency.mean());
status.setStatus(testName + " StdDev = " + latency.stdDev());
status.setStatus(testName + " 50th = " + sn.getMedian());
status.setStatus(testName + " 95th = " + sn.get95thPercentile());
status.setStatus(testName + " 99th = " + sn.get99thPercentile());
status.setStatus(testName + " 99.9th = " + sn.get999thPercentile());
status.setStatus(testName + " 99.99th = " + sn.getValue(0.9999));
status.setStatus(testName + " 99.999th = " + sn.getValue(0.99999));
status.setStatus(testName + " Max = " + latency.max());
}
示例13: getNumber
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
public Number getNumber(final Metric metric, final Snapshot none) {
if (metric instanceof Meter) {
Meter meter = (Meter) metric;
switch(this) {
case COUNT:
return meter.count();
case ONE_MINUTE_RATE:
return meter.oneMinuteRate();
case FIVE_MINUTE_RATE:
return meter.fiveMinuteRate();
case FIFTEEN_MINUTE_RATE:
return meter.fifteenMinuteRate();
case MEAN_RATE:
return meter.meanRate();
default:
throw new RuntimeException("Unexpected property");
}
} else {
throw new IllegalArgumentException("Invalid metric for property");
}
}
示例14: processHistogram
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void processHistogram(final MetricName metricName,
final Histogram histogram,
final Map context) throws Exception {
final Snapshot snapshot = histogram.getSnapshot();
final Map subMetrics =
ImmutableMap
.builder()
.put("75percentile", snapshot.get75thPercentile())
.put("95percentile", snapshot.get95thPercentile())
.put("99percentile", snapshot.get99thPercentile())
.put("median", snapshot.getMedian())
.put("mean", histogram.mean())
.put("min", histogram.min())
.put("max", histogram.max())
.put("stddev", histogram.stdDev())
.build();
context.put(toString(metricName), subMetrics);
}
示例15: processTimer
import com.yammer.metrics.stats.Snapshot; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void processTimer(final MetricName name, final Timer timer, final Map context) throws Exception {
final Snapshot snapshot = timer.getSnapshot();
final Map subMetrics =
ImmutableMap
.builder()
.put("count", timer.count())
.put("median", snapshot.getMedian())
.put("75percentile", snapshot.get75thPercentile())
.put("95percentile", snapshot.get95thPercentile())
.put("99percentile", snapshot.get99thPercentile())
.build();
context.put(toString(name), subMetrics);
}