collectors.py 文件源码

python
阅读 24 收藏 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 percentiles,
        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]

        e = self.get_value(labels)
        e = cast(Any, e)  # typing check, no runtime behaviour.

        # Set invariants data (default to 0.50, 0.90 and 0.99)
        for i in e._invariants:  # type: ignore
            q = i._quantile
            return_data[q] = e.query(q)  # type: ignore

        # Set sum and count
        return_data[self.SUM_KEY] = e._sum  # type: ignore
        return_data[self.COUNT_KEY] = e._observations  # type: ignore

        return return_data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号