具有相同模式的计数器和定时器不工作(普罗米修斯)

counter and timer with the same pattern do not work (Prometheus)

我在使用具有相同指标名称的计数器和计时器时遇到了问题:

my.controller.action:305|ms
my.controller.action:2|c

创建了这样的映射:

mappings:
- match: "my.*.*"
  name: "my_timers"
  observer_type: summary
  labels:
    controller: ""
    action: ""
- match: "my.*.*"
  name: "my_counters"
  labels:
    controller: ""
    action: ""

但此映射仅适用于计时器 - 第一个匹配的掩码。

statsd-exporter 我用于从 Graphite 迁移到 Prometheus。
但是 Statsd 的 Gpaphite 后端工作正常,它不同于计数器和计时器。
有没有什么方法可以在不更改度量字符串的情况下在 statsd-exporter 中执行相同的操作?

如果有人遇到同样的问题,解决方案非常简单:

mapping.config 中为计数器 match_metric_type: counter、计时器 match_metric_type: observer 添加以下行.