Class Summary.Builder

Enclosing class:
Summary

public static class Summary.Builder extends MetricWithFixedMetadata.Builder<B,M>
  • Field Details

  • Method Details

    • quantile

      public Summary.Builder quantile(double quantile)
      Add a quantile. See quantile(double, double).

      Default errors are:

      • error = 0.001 if quantile <= 0.01 or quantile >= 0.99
      • error = 0.005 if quantile <= 0.02 or quantile >= 0.98
      • error = 0.01 else.
    • quantile

      public Summary.Builder quantile(double quantile, double error)
      Add a quantile. Call multiple times to add multiple quantiles.

      Example: The following will track the 0.95 quantile:

      
       .quantile(0.95, 0.001)
       
      The second argument is the acceptable error margin, i.e. with the code above the quantile will not be exactly the 0.95 quantile but something between 0.949 and 0.951.

      There are two special cases:

      • .quantile(0.0, 0.0) gives you the minimum observed value
      • .quantile(1.0, 0.0) gives you the maximum observed value
    • maxAgeSeconds

      public Summary.Builder maxAgeSeconds(long maxAgeSeconds)
      The quantiles are relative to a moving time window. maxAgeSeconds is the size of that time window. Default is DEFAULT_MAX_AGE_SECONDS.
    • numberOfAgeBuckets

      public Summary.Builder numberOfAgeBuckets(int ageBuckets)
      The quantiles are relative to a moving time window. The numberOfAgeBuckets defines how smoothly the time window moves forward. For example, if the time window is 5 minutes and has 5 age buckets, then it is moving forward every minute by one minute. Default is DEFAULT_NUMBER_OF_AGE_BUCKETS.
    • toProperties

      protected io.prometheus.metrics.config.MetricsProperties toProperties()
      Override if there are more properties than just exemplars enabled.
    • getDefaultProperties

      public io.prometheus.metrics.config.MetricsProperties getDefaultProperties()
      Default properties for summary metrics.
    • build

      public Summary build()
      Specified by:
      build in class MetricWithFixedMetadata.Builder<Summary.Builder,Summary>
    • self

      protected Summary.Builder self()
      Specified by:
      self in class MetricWithFixedMetadata.Builder<Summary.Builder,Summary>
    • withExemplars

      public Summary.Builder withExemplars()
      Allow Exemplars for this metric.
    • withoutExemplars

      public Summary.Builder withoutExemplars()
      Turn off Exemplars for this metric.