I experienced a strange issue when using spring-cloud-feign
in conjunction HystrixCodaHaleMetricsPublisher
and Graphite
. Metrics nodes were created but no data came in.
My config:
@Configuration
@RequiredArgsConstructor
@EnableConfigurationProperties(ApiGatewayProperties.class)
@EnableFeignClients
public class AccountSettingsClientConfig {
private final ApiGatewayProperties apiGatewayProperties;
@Bean
public RequestInterceptor oauth2FeignRequestInterceptor() {
return new OAuth2FeignRequestInterceptor(new DefaultOAuth2ClientContext(), resource());
}
@Bean
public okhttp3.OkHttpClient okHttpClient() {
return new OkHttpClient.Builder().hostnameVerifier((s, sslSession) -> true)
.build();
}
@Bean
public AccountSettingsClientFallbackFactory accountSettingsClientFallbackFactory() {
return new AccountSettingsClientFallbackFactory();
}
Finally I found solution for the issue. The problem is, that default SetterFactory of FeignHistrix generates commandKey with invalid (for graphite) characters i.e.
development.local.AccountSettingsClient.AccountSettingsClient#accountSettings(String).countBadRequests
. Invalid chars in that case are # and (). When a GraphiteReport starts to send data into Graphite, everything works and the data get sent, but Graphite can't deal with it. So no data get persisted.As workaround I registered a custom SetterFactory:
and everything works now.