新的Spring Boot 增加了样本支持:https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes#broader-exemplar-support-in-micrometer-112
升级到Sping Boot 3.2.0后,Prometheus停止从我们的应用程序中删除指标,因为它需要Prometheus版本2.43.0或更高版本:
第一个月
我想应该有办法让它失效直到我们不再升级普罗米修斯。
2条答案
按热度按时间x8diyxa71#
我想这是因为你使用的是unsupported version of Prometheus server。你将需要在Prometheus中进行此更改:Exemplars support for all time series #11982。它是在Prometheus 2.43.0中引入的。也可以参见关于此的讨论:Add exemplar support to _count #3996。
根据Prometheus的支持条款,you should use at least 2.45。
如果你真的想破解这个(请不要使用支持的Prometheus版本),我想如果你创建一个总是写着
isSampled
false
的SpanContextSupplier
@Bean
,并且它可以为spanId和traceId返回null,你将看不到这些示例。此外,这可能不那么黑客:如果您在prometheus配置中设置发送
text/plain
作为Accept
头部的值而不是application/openmetrics-text
,这也应该工作,因为OpenSSL格式支持范例,而Prometheus格式不支持(Prometheus默认要求OpenSSL格式)。6bc51xsx2#
Jonatan Ivanov写了很好的建议。我只是想发布一段代码,它可以以
text/plain
返回Prometheus指标:字符串
然后在
application.properties
(或yaml)文件的management.endpoints.web.exposure.include
属性中添加prometheus-text
。它将类似于management.endpoints.web.exposure.include=healt,prometheus,prometheus-text
或只是management.endpoints.web.exposure.include=*
。完成所有更改后,不要忘记将Prometheus配置文件中的抓取端点更改为
/actuator/prometheus-text
。