/** * Returns the value at the 95th percentile in the distribution. * * @return the value at the 95th percentile in the distribution */ public double get95thPercentile() { return getValue(P95_Q); }
/** * Returns the value at the 98th percentile in the distribution. * * @return the value at the 98th percentile in the distribution */ public double get98thPercentile() { return getValue(P98_Q); }
/** * Returns the value at the 99th percentile in the distribution. * * @return the value at the 99th percentile in the distribution */ public double get99thPercentile() { return getValue(P99_Q); }
/** * Returns the median value in the distribution. * * @return the median value in the distribution */ public double getMedian() { return getValue(MEDIAN_Q); }
/** * Returns the value at the 75th percentile in the distribution. * * @return the value at the 75th percentile in the distribution */ public double get75thPercentile() { return getValue(P75_Q); }
/** * Returns the value at the 99.9th percentile in the distribution. * * @return the value at the 99.9th percentile in the distribution */ public double get999thPercentile() { return getValue(P999_Q); }
@Override public String value() { Map<String,Double> latencies = new HashMap<String,Double>(); for(Map.Entry<MetricName,Metric> e: registry.allMetrics().entrySet()) { Metric metric = e.getValue(); if(metric instanceof SHTimerMetric) { SHTimerMetric timerMetric = (SHTimerMetric)metric; latencies.put(e.getKey().getName(), timerMetric.getSnapshot().getValue(0.9D)); } } try { return objectMapper.writeValueAsString(sortMapReversedByValue(latencies)); } catch (Exception e) { log.error("JSON encoding problem", e); return "exception, see logs"; } } }
/** @return a summary of {@code hist}. */ public static String getHistogramReport(final Histogram hist) { Snapshot sn = hist.getSnapshot(); return ", mean=" + DOUBLE_FORMAT.format(hist.mean()) + ", min=" + DOUBLE_FORMAT.format(hist.min()) + ", max=" + DOUBLE_FORMAT.format(hist.max()) + ", stdDev=" + DOUBLE_FORMAT.format(hist.stdDev()) + ", 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)); } }
public void run() { SpeculativeRetry retryPolicy = ColumnFamilyStore.this.metadata.getSpeculativeRetry(); switch (retryPolicy.type) { case PERCENTILE: // get percentile in nanos assert metric.coordinatorReadLatency.durationUnit() == TimeUnit.MICROSECONDS; sampleLatencyNanos = (long) (metric.coordinatorReadLatency.getSnapshot().getValue(retryPolicy.value) * 1000d); break; case CUSTOM: // convert to nanos, since configuration is in millisecond sampleLatencyNanos = (long) (retryPolicy.value * 1000d * 1000d); break; default: sampleLatencyNanos = Long.MAX_VALUE; break; } } }, DatabaseDescriptor.getReadRpcTimeout(), DatabaseDescriptor.getReadRpcTimeout(), TimeUnit.MILLISECONDS);
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()); } }