Class Summary.Builder

Enclosing class:
Summary

  • 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.
    • getDefaultProperties

      Default properties for summary metrics.
    • build

    • exemplarLabelsSupplier

      public Summary.Builder exemplarLabelsSupplier(Supplier<Labels> supplier)
      Provide additional labels to be merged into every automatically-sampled exemplar of this metric. The supplier is called each time an exemplar is sampled, so it can return dynamic values (e.g. a request-scoped identifier from a thread-local). The supplier is only invoked when a valid, sampled span context is present; it has no effect when tracing is not active.

      For a global supplier that applies to all metrics (including metrics registered by third-party libraries you do not control), see ExemplarLabelsSupplier. When both are configured, this per-metric supplier takes precedence over the global one on a label-name collision, and the reserved trace_id/span_id labels always win over both. Labels that collide are silently dropped.

    • withExemplars

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

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