Class DistributionStatisticConfig
- java.lang.Object
-
- io.micrometer.core.instrument.distribution.DistributionStatisticConfig
-
- All Implemented Interfaces:
Mergeable<DistributionStatisticConfig>
public class DistributionStatisticConfig extends java.lang.Object implements Mergeable<DistributionStatisticConfig>
Configures the distribution statistics that emanate from meters likeTimer
andDistributionSummary
.These statistics include max, percentiles, percentile histograms, and SLA violations.
Many distribution statistics are decayed to give greater weight to recent samples.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DistributionStatisticConfig.Builder
-
Field Summary
Fields Modifier and Type Field Description static DistributionStatisticConfig
DEFAULT
static DistributionStatisticConfig
NONE
-
Constructor Summary
Constructors Constructor Description DistributionStatisticConfig()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DistributionStatisticConfig.Builder
builder()
java.lang.Integer
getBufferLength()
Statistics like max, percentiles, and histogram counts decay over time to give greater weight to recent samples (exception: histogram counts are cumulative for those systems that expect cumulative histogram buckets).java.time.Duration
getExpiry()
Statistics like max, percentiles, and histogram counts decay over time to give greater weight to recent samples (exception: histogram counts are cumulative for those systems that expect cumulative histogram buckets).java.util.NavigableSet<java.lang.Long>
getHistogramBuckets(boolean supportsAggregablePercentiles)
java.lang.Long
getMaximumExpectedValue()
The maximum value that the meter is expected to observe.java.lang.Long
getMinimumExpectedValue()
The minimum value that the meter is expected to observe.java.lang.Integer
getPercentilePrecision()
Determines the number of digits of precision to maintain on the dynamic range histogram used to compute percentile approximations.double[]
getPercentiles()
Produces an additional time series for each requested percentile.long[]
getSlaBoundaries()
Publish at a minimum a histogram containing your defined SLA boundaries.java.lang.Boolean
isPercentileHistogram()
Adds histogram buckets used to generate aggregable percentile approximations in monitoring systems that have query facilities to do so (e.g.boolean
isPublishingHistogram()
boolean
isPublishingPercentiles()
DistributionStatisticConfig
merge(DistributionStatisticConfig parent)
Merges two configurations.
-
-
-
Field Detail
-
DEFAULT
public static final DistributionStatisticConfig DEFAULT
-
NONE
public static final DistributionStatisticConfig NONE
-
-
Method Detail
-
builder
public static DistributionStatisticConfig.Builder builder()
-
merge
public DistributionStatisticConfig merge(DistributionStatisticConfig parent)
Merges two configurations. Any options that are non-null in this configuration take precedence. Any options that are non-null in the parent are used otherwise.- Specified by:
merge
in interfaceMergeable<DistributionStatisticConfig>
- Parameters:
parent
- The configuration to merge with. The parent takes lower precedence than this configuration.- Returns:
- A new, merged, immutable configuration.
-
getHistogramBuckets
public java.util.NavigableSet<java.lang.Long> getHistogramBuckets(boolean supportsAggregablePercentiles)
-
isPercentileHistogram
@Nullable public java.lang.Boolean isPercentileHistogram()
Adds histogram buckets used to generate aggregable percentile approximations in monitoring systems that have query facilities to do so (e.g. Prometheus'histogram_quantile
, Atlas':percentiles
).- Returns:
- This builder.
-
getPercentiles
@Nullable public double[] getPercentiles()
Produces an additional time series for each requested percentile. This percentile is computed locally, and so can't be aggregated with percentiles computed across other dimensions (e.g. in a different instance). UsepercentileHistogram
to publish a histogram that can be used to generate aggregable percentile approximations.- Returns:
- Percentiles to compute and publish. The 95th percentile should be expressed as
0.95
-
getPercentilePrecision
@Nullable public java.lang.Integer getPercentilePrecision()
Determines the number of digits of precision to maintain on the dynamic range histogram used to compute percentile approximations. The higher the degrees of precision, the more accurate the approximation is at the cost of more memory.- Returns:
- The digits of precision to maintain for percentile approximations.
-
getMinimumExpectedValue
@Nullable public java.lang.Long getMinimumExpectedValue()
The minimum value that the meter is expected to observe. Sets a lower bound on histogram buckets that are shipped to monitoring systems that support aggregable percentile approximations.- Returns:
- The minimum value that this distribution summary is expected to observe.
-
getMaximumExpectedValue
@Nullable public java.lang.Long getMaximumExpectedValue()
The maximum value that the meter is expected to observe. Sets an upper bound on histogram buckets that are shipped to monitoring systems that support aggregable percentile approximations.- Returns:
- The maximum value that the meter is expected to observe.
-
getExpiry
@Nullable public java.time.Duration getExpiry()
Statistics like max, percentiles, and histogram counts decay over time to give greater weight to recent samples (exception: histogram counts are cumulative for those systems that expect cumulative histogram buckets). Samples are accumulated to such statistics in ring buffers which rotate after this expiry, with a buffer length ofbufferLength
.- Returns:
- The amount of time samples are accumulated to a histogram before it is reset and rotated.
-
getBufferLength
@Nullable public java.lang.Integer getBufferLength()
Statistics like max, percentiles, and histogram counts decay over time to give greater weight to recent samples (exception: histogram counts are cumulative for those systems that expect cumulative histogram buckets). Samples are accumulated to such statistics in ring buffers which rotate afterexpiry
, with this buffer length.- Returns:
- The number of histograms to keep in the ring buffer.
-
getSlaBoundaries
@Nullable public long[] getSlaBoundaries()
Publish at a minimum a histogram containing your defined SLA boundaries. When used in conjunction withpercentileHistogram
, the boundaries defined here are included alongside other buckets used to generate aggregable percentile approximations.- Returns:
- The SLA boundaries to include the set of histogram buckets shipped to the monitoring system.
-
isPublishingPercentiles
public boolean isPublishingPercentiles()
-
isPublishingHistogram
public boolean isPublishingHistogram()
-
-