最后我找到了问题的解决方案。问题是,FeignHistrix的默认SetterFactory生成了带有无效字符(对于graphite)的commandKey,即。
development.local.AccountSettingsClient.AccountSettingsClient#accountSettings(String).countBadRequests
. 在这种情况下,无效字符是#和()。当GraphiteReport开始向Graphite发送数据时,一切都正常,数据也会被发送,但Graphite无法处理。因此没有数据被持久化。
作为解决方法,我注册了一个定制SetterFactory:
@Bean
public SetterFactory setterFactoryThatGeneratesGraphiteConformCommandKey() {
return (target, method) -> {
String groupKey = target.name();
//allowed chars for graphite are a-z, A-Z, 0-9, "-", "_", "." and "/".
//We don't use default SetterFactory.Default because it generates command key with parenthesis () and #
String commandKey = target.type().getSimpleName() + "-" + method.getName();
return HystrixCommand.Setter
.withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey))
.andCommandKey(HystrixCommandKey.Factory.asKey(commandKey));
};
}
现在一切都好了。