Python ASGI 监视
Instana Python 包提供了一个符合异步服务器网关接口(ASGI)规范的中间件,可为您的异步应用程序提供请求可见性。
有关 ASGI 的更多信息,请参阅 ASGI 文档。
中介軟體
Instana ASGI 中间件位于instana.middleware.InstanaASGIMiddleware,可以与任何符合 ASGI 的应用程序配合使用。
请访问 GitHub ,查看 instana/python-sensor 仓库中实现 Instana ASGI 中间件的开源代码。
示例
import uvicorn
from instana.middleware import InstanaASGIMiddleware
# ...application definition code...
# Wrap the ASGI application with the Instana ASGI middleware
application = InstanaASGIMiddleware(application)
uvicorn.run(application, host='127.0.0.1', port=80)