Class Distribution.BucketOptions

java.lang.Object
io.opencensus.metrics.export.Distribution.BucketOptions
Direct Known Subclasses:
Distribution.BucketOptions.ExplicitOptions
Enclosing class:
Distribution

@Immutable public abstract static class Distribution.BucketOptions extends Object
The bucket options used to create a histogram for the distribution.
Since:
0.17
  • Constructor Details

    • BucketOptions

      private BucketOptions()
  • Method Details

    • explicitOptions

      public static Distribution.BucketOptions explicitOptions(List<Double> bucketBoundaries)
      Returns a Distribution.BucketOptions.ExplicitOptions.

      The bucket boundaries for that histogram are described by bucket_bounds. This defines size(bucket_bounds) + 1 (= N) buckets. The boundaries for bucket index i are:

      • [0, bucket_bounds[i]) for i == 0
      • [bucket_bounds[i-1], bucket_bounds[i]) for 0 < i < N-1
      • [bucket_bounds[i-1], +infinity) for i == N-1

      If bucket_bounds has no elements (zero size), then there is no histogram associated with the Distribution. If bucket_bounds has only one element, there are no finite buckets, and that single element is the common boundary of the overflow and underflow buckets. The values must be monotonically increasing.

      Parameters:
      bucketBoundaries - the bucket boundaries of a distribution (given explicitly). The values must be strictly increasing and should be positive values.
      Returns:
      a ExplicitOptions BucketOptions.
      Since:
      0.17
    • match

      public abstract <T> T match(Function<? super Distribution.BucketOptions.ExplicitOptions,T> explicitFunction, Function<? super Distribution.BucketOptions,T> defaultFunction)
      Applies the given match function to the underlying BucketOptions.
      Parameters:
      explicitFunction - the function that should be applied if the BucketOptions has type ExplicitOptions.
      defaultFunction - the function that should be applied if the BucketOptions has a type that was added after this match method was added to the API. See Functions for some common functions for handling unknown types.
      Returns:
      the result of the function applied to the underlying BucketOptions.
      Since:
      0.17