【发布时间】:2021-08-18 21:21:52
【问题描述】:
我使用 springboot 作为微服务。
我的 k8s 集群中有大约 20 个微服务。
我正在使用 promethues 收集数据以在 grafana 中显示。
在该应用程序中有一些使用 Path 变量的 url,如下所示
- /v1/contacts/{id}
- /v1/users/{id}
还有几个 url,如果我考虑所有微服务中的所有此类 URL,那么可能是使用路径变量的 60 到 70 个 URL。
问题:
现在每当请求任何网址时,即喜欢
- /v1/contacts/10
- /v1/contacts/111
- /v1/contacts/51
- /v1/users/91
等等……
然后 promethus 正在收集所有此类 url 的指标。一段时间后,它有巨大的指标,最后我的响应时间增加了从普罗米修斯收集数据。
所以基本上我想在我的 springboot 应用程序间隔一段时间后清除 prometheus 日志。
我不确定这是否可能。
有人可以帮我解决这个问题吗?
谢谢
【问题讨论】:
-
您是否考虑过从 Spring Boot 发送像 robustperception.io/deleting-time-series-from-prometheus 这样的 http post 请求?或者更好的解决方案是在普罗米修斯抓取时间过滤不需要的指标?
-
@Felipe 这就像从 prometheus 服务器中删除 prometheus 数据一样,我的问题是 /actuator/promethes 端点进入 sprintboot 应用程序。 Prometheus 数据存储在 springboot 应用程序中,因此会影响性能。
标签: spring-boot prometheus spring-boot-actuator spring-cloud-gateway prometheus-java