【发布时间】:2021-08-06 21:06:09
【问题描述】:
我正在为 http 请求启用直方图,所以我可以在 prometheus 中使用 histogram_quantile。
所以我已经配置了management.metrics.distribution.percentiles-histogram[http.server.requests]: true 并且还设置了 minimum-expected-value 和 maximum-expected-value 以防止桶过多并尝试降低基数。
默认情况下,spring-boot 为任何@RestController(异常、方法、结果、状态、uri)设置以下 WebMvc 标记。例如,对于 http_server_requests_seconds_count 指标来说,这非常有用(并且被使用)。
但是,对于直方图,它会创建 http_server_requests_seconds_bucket。桶列表的大小已减少了最小值/最大值,但它会为每个唯一的标签组合创建桶。我不太关心为每个异常或结果指定响应时间段。对于 uri/method,请。
文档说要替换默认标签,以提供实现 WebMvcTagsProvider 的 @Bean。但我不想替换它们,因为我仍然希望它们用于 http_server_requests_seconds_count,我只是不需要它们用于直方图。
有没有办法以聚合特定标签的直方图桶的方式对其进行配置?
【问题讨论】:
标签: spring-boot prometheus micrometer