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
评论列表
文章目录