是否有一个arg在start_http_server(prometheus_client)中设置其他端点而不是/?

问题描述 投票:1回答:1

我正在构建一个Flask应用程序,我想知道模块start_http_server(来自prometheus_client)是否有一个arg允许我设置一个特定的度量端点而不是/。

谢谢!

python flask instrumentation prometheus
1个回答
0
投票

使用带有烧瓶的Prometheus客户端时,您无需自己启动http服务器,但可以启用wsgi中间件并指定要在现有应用程序上提供指标的路径。

app = Flask(__name__)
app_dispatch = DispatcherMiddleware(app, {
  '/metrics': make_wsgi_app()
})

如需完整示例,请查看python prometheus_client docs on flask

© www.soinside.com 2019 - 2024. All rights reserved.