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 like Timer and DistributionSummary.

These statistics include max, percentiles, percentile histograms, and SLA violations.

Many distribution statistics are decayed to give greater weight to recent samples.

  • Field Details

  • Constructor Details

    • DistributionStatisticConfig

      public DistributionStatisticConfig()
  • Method Details

    • builder

      public static DistributionStatisticConfig.Builder builder()
    • merge

      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 interface Mergeable<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.Double> getHistogramBuckets​(boolean supportsAggregablePercentiles)
      For internal use only.
      Parameters:
      supportsAggregablePercentiles - whether it supports aggregable percentiles
      Returns:
      histogram buckets
    • 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). Use percentileHistogram 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

      @Deprecated @Nullable public java.lang.Double getMinimumExpectedValue()
      Deprecated.
      Use getMinimumExpectedValueAsDouble(). If you use this method, your code will not be compatible with code that uses Micrometer 1.3.x.
      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.
    • getMinimumExpectedValueAsDouble

      @Nullable public java.lang.Double getMinimumExpectedValueAsDouble()
      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

      @Deprecated @Nullable public java.lang.Double getMaximumExpectedValue()
      Deprecated.
      Use getMaximumExpectedValueAsDouble(). If you use this method, your code will not be compatible with code that uses Micrometer 1.3.x.
      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.
    • getMaximumExpectedValueAsDouble

      @Nullable public java.lang.Double getMaximumExpectedValueAsDouble()
      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 of bufferLength.
      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 after expiry, with this buffer length.
      Returns:
      The number of histograms to keep in the ring buffer.
    • getSlaBoundaries

      @Nullable @Deprecated public double[] getSlaBoundaries()
      Deprecated.
      Use getServiceLevelObjectiveBoundaries(). If you use this method, your code will not be compatible with code that uses Micrometer 1.4.x and later.
      Publish at a minimum a histogram containing your defined SLA boundaries. When used in conjunction with percentileHistogram, the boundaries defined here are included alongside other buckets used to generate aggregable percentile approximations. If the DistributionStatisticConfig is meant for use with a Timer, the SLA unit is in nanoseconds.
      Returns:
      The SLA boundaries to include the set of histogram buckets shipped to the monitoring system.
    • getServiceLevelObjectiveBoundaries

      @Nullable public double[] getServiceLevelObjectiveBoundaries()
      Publish at a minimum a histogram containing your defined SLO boundaries. When used in conjunction with percentileHistogram, the boundaries defined here are included alongside other buckets used to generate aggregable percentile approximations. If the DistributionStatisticConfig is meant for use with a Timer, the SLO unit is in nanoseconds.
      Returns:
      The SLO boundaries to include the set of histogram buckets shipped to the monitoring system.
    • isPublishingPercentiles

      public boolean isPublishingPercentiles()
    • isPublishingHistogram

      public boolean isPublishingHistogram()