collectors.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:aioprometheus 作者: claws 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号