def get(self,
labels: LabelsType) -> Dict[Union[float, str], NumericValueType]:
'''
Get gets a dict of values, containing the sum, count and buckets,
matching an arbitrary group of labels.
:raises: KeyError if an item with matching labels is not present.
'''
return_data = {} # type: Dict[Union[float, str], NumericValueType]
h = self.get_value(labels)
h = cast(histogram.Histogram, h) # typing check, no runtime behaviour.
for upper_bound, cumulative_count in h.buckets.items():
return_data[upper_bound] = cumulative_count # keys are floats
# Set sum and count
return_data[self.SUM_KEY] = h.sum
return_data[self.COUNT_KEY] = h.observations
return return_data
评论列表
文章目录