我正在构建一个Flask应用程序,我想知道模块start_http_server(来自prometheus_client)上是否有一个arg,该参数允许我设置特定的指标终结点/。
谢谢!
答案 0 :(得分:0)
将Prometheus客户端与flask一起使用时,不需要自己启动http服务器,但是可以启用wsgi中间件并指定要在现有应用程序上提供指标的路由。
app = Flask(__name__)
app_dispatch = DispatcherMiddleware(app, {
'/metrics': make_wsgi_app()
})
有关如何执行此操作的完整示例,只需查看python prometheus_client docs on flask。