我有一个aiohttp
基于应用程序并公开/检测一个简单的路线,如下所示,尝试坚持以下三步演示:README.md
@REQUEST_TIME.time()
@routes.get('/endpoint')
async def my_service(request):
ws = web.WebSocketResponse()
await ws.prepare(request)
async for msg in ws:
do_stuff()
return ws
我(成功)使用以下客户端访问端点:
from websocket import create_connection
ws = create_connection("ws://localhost:6543/endpoint")
data = prepare_data()
ws.send(full_data)
ws.close()
但是,以下指标保持不变:
# HELP request_processing_seconds Time spent processing request
# TYPE request_processing_seconds summary
request_processing_seconds_count 0.0
request_processing_seconds_sum 0.0
# HELP request_processing_seconds_created Time spent processing request
# TYPE request_processing_seconds_created gauge
request_processing_seconds_created 1.6161408098226109e+09