跳转到主要内容

为prometheus_client提供异步辅助工具。

项目描述

prometheus-async

Documentation License: Apache 2.0 PyPI version Downloads / Month

prometheus-asyncPython客户端(用于 Prometheus 度量和监控系统)添加了对异步框架的支持。

目前支持Python 3.7及更高版本上的 asyncioTwisted

它通过包装官方客户端的度量来工作

import asyncio

from aiohttp import web
from prometheus_client import Histogram
from prometheus_async.aio import time

REQ_TIME = Histogram("req_time_seconds", "time spent in requests")

@time(REQ_TIME)
async def req(request):
      await asyncio.sleep(1)
      return web.Response(body=b"hello")

即使是针对 同步 应用程序,度量暴露方法也可能很有用,因为它们比官方客户端提供的更强大。为此,已添加辅助函数,在单独的线程中运行它们(仅限 asyncio)。

源代码托管在 GitHub 上,文档在 Read The Docs 上。

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

prometheus-async-22.2.0.tar.gz (35.3 kB 查看哈希值)

上传时间

构建分发

prometheus_async-22.2.0-py3-none-any.whl (17.8 kB 查看哈希值)

上传时间 Python 3

支持者