【问题标题】:Spring Boot 2 - Some Graphite Metrics not receiving common tags from customizerSpring Boot 2 - 一些 Graphite Metrics 没有从定制器接收公共标签
【发布时间】:2018-07-03 23:11:01
【问题描述】:

我正在使用 Spring Boot 2 + Graphite 报告,并且有一些指标正在接收通用标签,而有些则不是。

我有两个除了名称之外相同的 bean,它们都使用相同的代码创建了一个计时器。其中一个是首先创建的并且没有应用 commonTags,另一个是。例如,

@Autowired
MeterRegistry meterRegistry

@Bean Foo doesNotGetCommonTags() {
    meterRegistry.timer(...);
    ...
}

@Bean MeterRegistryCustomizer<GraphiteMeterRegistry> graphiteCustomizer() {
   return r -> r.config().commonTags(...);
}

@Bean Foo getsCommonTags() {
    meterRegistry.timer(...);
    ...
}

这似乎与 bean 创建顺序有关,但我无法弄清楚如何确保在创建仪表之前完全自定义我的注册表。我使用通用标签作为前缀,所以这会导致一些指标被发送到 Graphite 无前缀,而另一些则是。

我不明白是什么原因造成的。我的石墨定制器应该在注入指标注册表之前应用,对吧?

【问题讨论】:

    标签: spring spring-boot spring-boot-actuator micrometer


    【解决方案1】:

    我的解决方法(我不认为这是一个完整的解决方案)是不使用 MeterRegsitryCustomizer,而是使用我想要的自定义设置自己创建 Graphite 注册表。

    【讨论】:

      猜你喜欢
      • 2018-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-29
      • 2018-12-16
      • 1970-01-01
      • 1970-01-01
      • 2020-01-16
      相关资源
      最近更新 更多