Method: Prometheus::Client::Histogram#get

Defined in:
lib/prometheus/client/histogram.rb

#get(labels: {}) ⇒ Object

Returns a hash with all the buckets plus +Inf (count) plus Sum for the given label set



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/prometheus/client/histogram.rb', line 88

def get(labels: {})
  base_label_set = label_set_for(labels)

  all_buckets = buckets + ["+Inf", "sum"]

  @store.synchronize do
    all_buckets.each_with_object({}) do |upper_limit, acc|
      acc[upper_limit.to_s] = @store.get(labels: base_label_set.merge(le: upper_limit.to_s))
    end.tap do |acc|
      accumulate_buckets(acc)
    end
  end
end