为prometheus_client提供异步辅助工具。
项目描述
prometheus-async
prometheus-async 为 Python客户端(用于 Prometheus 度量和监控系统)添加了对异步框架的支持。
目前支持Python 3.7及更高版本上的 asyncio 和 Twisted。
它通过包装官方客户端的度量来工作
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的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b0426370eb3b3bacd99afcf1fcc669c118cb67603cc951a6fe12434e9d4307f2 |
|
MD5 | 8cace4103505c4c45ce7c1667fe680d3 |
|
BLAKE2b-256 | 121c6e3a318f06e786b892a12196bfb5d873802dbabc2eedd7c5b8a88098d0f5 |
关闭
prometheus_async-22.2.0-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 5cbfa535561342b834c087c4f3f3be0a3cb8785a0b8748111c916f3d68bbc370 |
|
MD5 | 79a9f199ab8beb35de9ef4b61622eb42 |
|
BLAKE2b-256 | 65340d20a85b07fe16ad3423b0f11d37a3345e6967cc7391825d8f3b87f0e704 |