如何在 Micrometer 中计量外部计数器?

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

我想用 Micrometer 测量外部系统计数器。

对于上下文: 我想提供 Redis Streams 特定指标,例如 https://redis.io/docs/latest/commands/xinfo-groups/

有一个名为

entries-read
的字段,文档说:

entries-read: the logical "read counter" of the last entry delivered to the group's consumers

我注意到我不能使用千分尺

Counter
,因为它只会增加值。

对于这种类型的外部计数器我应该使用

Gauge
还是有其他方法?

grafana counter micrometer redis-streams
1个回答
0
投票

如果它确实是一个计数器(单调),你可以使用

FunctionCounter
,你可以在Micrometer的代码库中找到很多用例。

如果不是(非单调),您可以使用

Gauge

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