public final class PercentileDistributionSummary extends Object implements DistributionSummary
Percentile distribution summaries are expensive compared to basic distribution summaries
from the registry. In particular they have a higher storage cost, worst case ~300x, to
maintain the data distribution. Be diligent about any additional dimensions added to percentile
distribution summaries and ensure they have a small bounded cardinality. In addition it is
highly recommended to set a threshold (see PercentileDistributionSummary.Builder.withRange(long, long)
) whenever
possible to greatly restrict the worst case overhead.
Modifier and Type | Class and Description |
---|---|
static class |
PercentileDistributionSummary.Builder
Helper for getting instances of a PercentileDistributionSummary.
|
DistributionSummary.BatchUpdater
Modifier and Type | Method and Description |
---|---|
static IdBuilder<PercentileDistributionSummary.Builder> |
builder(Registry registry)
Return a builder for configuring and retrieving and instance of a percentile distribution
summary.
|
long |
count()
The number of times that record has been called since this timer was last reset.
|
static PercentileDistributionSummary |
get(Registry registry,
Id id)
Creates a distribution summary object that can be used for estimating percentiles.
|
boolean |
hasExpired()
Indicates whether the meter is expired.
|
Id |
id()
Identifier used to lookup this meter in the registry.
|
Iterable<Measurement> |
measure()
Get the set of measurements for this meter.
|
double |
percentile(double p)
Computes the specified percentile for this distribution summary.
|
void |
record(long amount)
Updates the statistics kept by the summary with the specified amount.
|
void |
record(long[] amounts,
int n)
Updates the statistics kept by the summary with the specified amounts as a batch.
|
long |
totalAmount()
The total amount of all recorded events since this summary was last reset.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
batchUpdater
public static PercentileDistributionSummary get(Registry registry, Id id)
PercentileDistributionSummary.Builder.withRange(long, long)
) whenever possible.registry
- Registry to use.id
- Identifier for the metric being registered.public static IdBuilder<PercentileDistributionSummary.Builder> builder(Registry registry)
public Id id()
Meter
public Iterable<Measurement> measure()
Meter
public boolean hasExpired()
Meter
hasExpired
in interface Meter
public void record(long amount)
DistributionSummary
record
in interface DistributionSummary
amount
- Amount for an event being measured. For example, if the size in bytes of responses
from a server. If the amount is less than 0 the value will be dropped.public void record(long[] amounts, int n)
DistributionSummary
record
in interface DistributionSummary
amounts
- Amounts for an event being measured. For example, if the size in bytes of responses
from a server. If the amount is less than 0 the value will be dropped.n
- The number of elements to write from the amounts array (starting from 0). If n is
<= 0 no entries will be recorded. If n is greater than amounts.length, all amounts
will be recorded.DistributionSummary.record(long)
public double percentile(double p)
p
- Percentile to compute, value must be 0.0 <= p <= 100.0
.p
`th percentile in seconds.public long count()
DistributionSummary
count
in interface DistributionSummary
public long totalAmount()
DistributionSummary
totalAmount
in interface DistributionSummary