After you connect a Java application that uses OpenFeign to ARMS Application Monitoring, application data may be incomplete and data of downstream applications may fail to be displayed.
This happens because OpenFeign enables Hystrix by default, and Hystrix uses the RxJava asynchronous framework internally. When Hystrix dispatches a request to a different thread, the ARMS agent loses the trace context, which breaks the link between upstream and downstream calls.
This issue affects only ARMS agent versions earlier than 2.6.0. ARMS agent 2.6.0 and later supports asynchronous frameworks and traces OpenFeign + Hystrix calls correctly without any changes.
Solution
Option 1: Upgrade the ARMS agent (recommended)
Upgrade the ARMS agent for your Java application to version 2.6.0 or later. This version supports asynchronous frameworks natively, so OpenFeign + Hystrix calls are traced without code changes.
Option 2: Switch from Hystrix to OkHttp
If you cannot upgrade the ARMS agent, disable Hystrix and use OkHttp as the HTTP client for Feign. This avoids the asynchronous thread-switching that causes trace context loss.
Add the
feign-okhttpdependency to your pom.xml file:<!-- Use OkHttp as the HTTP client for Feign --> <dependency> <groupId>io.github.openfeign</groupId> <artifactId>feign-okhttp</artifactId> </dependency>Update your Spring Cloud configuration file to enable OkHttp and disable Hystrix:
feign.okhttp.enabled: true feign.hystrix.enabled: falseAdd an OkHttp configuration class to your project: Adjust the timeout values based on your application requirements.
@Configuration @ConditionalOnClass(Feign.class) @AutoConfigureBefore(FeignAutoConfiguration.class) public class FeignClientOkHttpConfiguration { @Bean public OkHttpClient okHttpClient() { return new OkHttpClient.Builder() .connectTimeout(20, TimeUnit.SECONDS) // Connection timeout .readTimeout(20, TimeUnit.SECONDS) // Response timeout .writeTimeout(20, TimeUnit.SECONDS) // Write request timeout .retryOnConnectionFailure(true) // Enable automatic reconnection .connectionPool(new ConnectionPool()) // Use the default connection pool .build(); } }
Verify the result
After you apply either solution, restart your application and check the ARMS Application Monitoring console:
Application data for OpenFeign calls is complete.
Data of downstream applications is displayed correctly.