![](/img/trans.png)
[英]Prometheus how to expose metrics in multiprocess app with start_http_server
[英]Is there an arg to set other endpoint in start_http_server (prometheus_client) instead of /?
我正在构建Flask应用程序,我想知道模块start_http_server
(来自prometheus_client)上是否有一个arg,该参数允许我设置特定的指标终结点/。
谢谢!
将Prometheus客户端与flask一起使用时,不需要自己启动http服务器,但是可以启用wsgi中间件并指定要在现有应用程序上提供指标的路由。
app = Flask(__name__)
app_dispatch = DispatcherMiddleware(app, {
'/metrics': make_wsgi_app()
})
有关如何执行此操作的完整示例,只需查看flask上的python prometheus_client docs 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.