@Override public void jsonData(JsonObjectBuilder builder) { JsonObjectBuilder myBuilder = JSON.createObjectBuilder(); myBuilder.add("count", getCount()); Snapshot snapshot = getSnapshot(); myBuilder.add("min", snapshot.getMin()); myBuilder.add("max", snapshot.getMax()); myBuilder.add("mean", snapshot.getMean()); myBuilder.add("stddev", snapshot.getStdDev()); myBuilder.add("p50", snapshot.getMedian()); myBuilder.add("p75", snapshot.get75thPercentile()); myBuilder.add("p95", snapshot.get95thPercentile()); myBuilder.add("p98", snapshot.get98thPercentile()); myBuilder.add("p99", snapshot.get99thPercentile()); myBuilder.add("p999", snapshot.get999thPercentile()); builder.add(getName(), myBuilder.build()); }
@Override public void jsonData(JsonObjectBuilder builder) { JsonObjectBuilder myBuilder = JSON.createObjectBuilder(); myBuilder.add("count", getCount()); myBuilder.add("meanRate", getMeanRate()); myBuilder.add("oneMinRate", getOneMinuteRate()); myBuilder.add("fiveMinRate", getFiveMinuteRate()); myBuilder.add("fifteenMinRate", getFifteenMinuteRate()); Snapshot snapshot = getSnapshot(); myBuilder.add("min", snapshot.getMin()); myBuilder.add("max", snapshot.getMax()); myBuilder.add("mean", snapshot.getMean()); myBuilder.add("stddev", snapshot.getStdDev()); myBuilder.add("p50", snapshot.getMedian()); myBuilder.add("p75", snapshot.get75thPercentile()); myBuilder.add("p95", snapshot.get95thPercentile()); myBuilder.add("p98", snapshot.get98thPercentile()); myBuilder.add("p99", snapshot.get99thPercentile()); myBuilder.add("p999", snapshot.get999thPercentile()); builder.add(getName(), myBuilder.build()); }
public double getP95() { return getSnapshot().get95thPercentile(); }
public double getP95() { return getSnapshot().get95thPercentile(); }
@Test public void testSnapshot95thPercentile() throws Exception { TestUtils.assertEqualsWithTolerance(96, histogramInt.getSnapshot().get95thPercentile()); TestUtils.assertEqualsWithTolerance(960, histogramLong.getSnapshot().get95thPercentile()); }
private StringBuilder toPrometheus(final String registryKey, final String keyBase, final String keyUnit, final Snapshot snapshot, final Metadata metadata) { final Function<Map<String, String>, Metadata> metaFactory = tag -> new Metadata(metadata.getName(), metadata.getDisplayName(), metadata.getDescription(), metadata.getTypeRaw(), metadata.getUnit(), Stream.concat(metadata.getTags().entrySet().stream(), tag.entrySet().stream()) .map(e -> e.getKey() + '=' + e.getValue()) .collect(joining(","))); final String completeKey = keyBase + keyUnit; return new StringBuilder() .append(value(registryKey, keyBase + "_min" + keyUnit, snapshot.getMin(), metadata)) .append(value(registryKey, keyBase + "_max" + keyUnit, snapshot.getMax(), metadata)) .append(value(registryKey, keyBase + "_mean" + keyUnit, snapshot.getMean(), metadata)) .append(value(registryKey, keyBase + "_stddev" + keyUnit, snapshot.getStdDev(), metadata)) .append(value(registryKey, completeKey, snapshot.getMedian(), metaFactory.apply(singletonMap("quantile", "0.5")))) .append(value(registryKey, completeKey, snapshot.get75thPercentile(), metaFactory.apply(singletonMap("quantile", "0.75")))) .append(value(registryKey, completeKey, snapshot.get95thPercentile(), metaFactory.apply(singletonMap("quantile", "0.95")))) .append(value(registryKey, completeKey, snapshot.get98thPercentile(), metaFactory.apply(singletonMap("quantile", "0.98")))) .append(value(registryKey, completeKey, snapshot.get99thPercentile(), metaFactory.apply(singletonMap("quantile", "0.99")))) .append(value(registryKey, completeKey, snapshot.get999thPercentile(), metaFactory.apply(singletonMap("quantile", "0.999")))); }
@Test public void testSnapshot95thPercentile() throws Exception { TestUtils.assertEqualsWithTolerance(960, globalTimer.getSnapshot().get95thPercentile()); }
json.writeObjectField("p50", snapshot.getMedian()); json.writeObjectField("p75", snapshot.get75thPercentile()); json.writeObjectField("p95", snapshot.get95thPercentile()); json.writeObjectField("p98", snapshot.get98thPercentile()); json.writeObjectField("p99", snapshot.get99thPercentile()); json.writeObjectField("p50", snapshot.getMedian()); json.writeObjectField("p75", snapshot.get75thPercentile()); json.writeObjectField("p95", snapshot.get95thPercentile()); json.writeObjectField("p98", snapshot.get98thPercentile()); json.writeObjectField("p99", snapshot.get99thPercentile());
double medianVal = sampling.getSnapshot().getMedian(); double percentile75th = sampling.getSnapshot().get75thPercentile(); double percentile95th = sampling.getSnapshot().get95thPercentile(); double percentile98th = sampling.getSnapshot().get98thPercentile(); double percentile99th = sampling.getSnapshot().get99thPercentile(); medianVal = sampling.getSnapshot().getMedian() * conversionFactor; percentile75th = sampling.getSnapshot().get75thPercentile() * conversionFactor; percentile95th = sampling.getSnapshot().get95thPercentile() * conversionFactor; percentile98th = sampling.getSnapshot().get98thPercentile() * conversionFactor; percentile99th = sampling.getSnapshot().get99thPercentile() * conversionFactor;