class OpenCensus::Stats::Aggregation::Distribution

Distribution aggregation type

Attributes

buckets[R]

@return [Array<Integer>,Array<Float>] Bucket boundries.

Public Class Methods

new(buckets) click to toggle source

@private @param [Array<Integer>,Array<Float>,] buckets Buckets boundries for distribution aggregation. @raise [InvalidBucketsError] If any bucket value is nil.

# File lib/opencensus/stats/aggregation/distribution.rb, line 20
def initialize buckets
  if buckets.nil? || buckets.empty?
    raise InvalidBucketsError, "buckets should not be nil or empty"
  end

  if buckets.any?(&:nil?)
    raise InvalidBucketsError, "buckets value should not be nil"
  end

  @buckets = buckets.reject { |v| v < 0 }
end

Public Instance Methods

create_aggregation_data() click to toggle source

Create new aggregation data container to store distribution values. values. @return [AggregationData::Distribution]

# File lib/opencensus/stats/aggregation/distribution.rb, line 35
def create_aggregation_data
  AggregationData::Distribution.new @buckets
end