Prometheus/Grafana组合标签
我需要的是为每个URL制作一个单独的Grafana仪表板过滤器。例如,我的URL例如:
- 获取V1/用户
- post v1/用户
- put v1/用户
- 删除v1/users/{id}
- get v1/users/{id}
,在prometheus中,它们被存储得像:
http_responses_total{ method="GET", path="v1/users", status="200"}
http_responses_total{ method="POST", path="v1/users", status="200"}
http_responses_total{ method="PUT", path="v1/users", status="200"}
http_responses_total{ method="DELETE", path="v1/users/{id}", status="200"}
http_responses_total{ method="GET", path="v1/users/{id}", status="200"}
我可以做一个仪表板变量。喜欢:
label_values(api_requests_total,route)
将生成列表,例如:
- 所有
- V1/用户
- V1/users/{id}
或
label_values(api_requests_total,method)
列表,例如:
- 所有
- get
- post
- put put
- delete delete
将生成 喜欢:
- 全部
- 获取V1/用户
- 发布V1/用户
- put v1/用户
- 删除V1/users/{id}
- 获取V1/users/{id}
What I need is to make a separate grafana dashboard filter for each url. For example I have urls like:
- GET v1/users
- POST v1/users
- PUT v1/users
- DELETE v1/users/{id}
- GET v1/users/{id}
and in Prometheus they are stored like:
http_responses_total{ method="GET", path="v1/users", status="200"}
http_responses_total{ method="POST", path="v1/users", status="200"}
http_responses_total{ method="PUT", path="v1/users", status="200"}
http_responses_total{ method="DELETE", path="v1/users/{id}", status="200"}
http_responses_total{ method="GET", path="v1/users/{id}", status="200"}
and I can make a dashboard variable like:
label_values(api_requests_total,route)
which will generate the list like:
- all
- v1/users
- v1/users/{id}
or
label_values(api_requests_total,method)
which will generate the list like:
- all
- GET
- POST
- PUT
- DELETE
but I want to generate a list like:
- All
- GET v1/users
- POST v1/users
- PUT v1/users
- DELETE v1/users/{id}
- GET v1/users/{id}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论