service.py 文件源码

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

项目:aioprometheus 作者: claws 项目源码 文件源码
def __init__(self,
                 registry: Registry = None,
                 loop: BaseEventLoop = None) -> None:
        '''
        Initialise the Prometheus metrics service.

        :param registry: A :class:`CollectorRegistry` instance that will
          hold all the metrics for this service. If no registry if specified
          then the default registry is used.

        :param loop: The event loop instance to use. If no loop is specified
          then the default event loop will be retrieved.

        :raises: Exception if the registry object is not an instance of the
          Registry type.
        '''
        self.loop = loop or asyncio.get_event_loop()
        if registry is not None and not isinstance(registry, Registry):
            raise Exception(
                'registry must be a Registry, got: {}'.format(registry))
        self.registry = registry or Registry()
        self._svr = None  # type: Server
        self._svc = None  # type: aiohttp.web.Application
        self._handler = None  # type: aiohttp.web.RequestHandlerFactory
        self._https = None  # type: bool
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号