【发布时间】:2019-12-02 13:32:29
【问题描述】:
大家晚上好。 我已经创建了 GraphiteMeterRegistry bean。
@Bean
public GraphiteMeterRegistry meterRegistry(GraphiteConfig graphiteConfig) {
String host;
try {
host = InetAddress.getLocalHost().getHostName().replaceAll("\\.","_");
} catch (UnknownHostException e) {
host = "test";
log.warn("Host wasn't found", e);
}
String prefix = "lm." + host + ".";
return new GraphiteMeterRegistry(graphiteConfig, Clock.SYSTEM,
(id, convention) -> prefix + HierarchicalNameMapper.DEFAULT.toHierarchicalName(id, convention));
}
它会发送默认的 stas、jvm、hiharicp、http 和 e.t.c,这很好。但是,当我想获取有关 httpRequests 到我的端点(称为“myendpoint”)的信息时,我发现它不是存储在 myendpoint 文件夹中,而是存储在每个 id 的百万个文件夹中(作为参数获取)。例如:
myendpoint&id=12345679
myendpoint&id=12345672
myendpoint&id=12345673
myendpoint&id=12345671
但我希望这个名称对于同一个端点是相同的。你是怎么配置的?
【问题讨论】:
-
在这种情况下这个 id 是路径/查询参数吗?这不应该添加到 Spring Boot 中的指标名称中。你能分享一下你是如何定义其余端点的吗?你的控制器类?
标签: spring-boot graphite micrometer