All Products
Search
Document Center

Application Real-Time Monitoring Service:Why is the data of my application that uses the OpenFeign component incomplete in ARMS?

Last Updated:Aug 25, 2023

After your application that uses the OpenFeign component is connected to ARMS Application Monitoring, the application data may be incomplete and the data of downstream applications may fail to be displayed. This issue may occur because the OpenFeign component enables Hystrix that uses the RxJava asynchronous framework by default. However, ARMS does not support asynchronous frameworks.

Note

This topic applies to scenarios in which the version of the ARMS agent for Java applications is earlier than 2.6.0. The ARMS agent of version 2.6.0 or later that is provided for Java applications supports asynchronous frameworks.

You can disable Hystrix and enable the OkHttp request class to resolve this issue.

  1. Add the following dependency to the pom.xml file:

    <!-- OKHttp supports Feign -->
    <dependency>
     <groupId>io.github.openfeign</groupId>
     <artifactId>feign-okhttp</artifactId>
    </dependency> 
  2. Add the following content to the SpringCloud configuration file:

    feign.okhttp.enabled: true
    feign.hystrix.enabled: false 
  3. Configure the OkHttp request class:

    @Configuration
    @ConditionalOnClass(Feign.class)
    @AutoConfigureBefore(FeignAutoConfiguration.class)
    public class FeignClientOkHttpConfiguration {
    
     @Bean
     public OkHttpClient okHttpClient() {
     return new OkHttpClient.Builder()
     // The connection times out.
     .connectTimeout(20, TimeUnit.SECONDS)
     // The response times out.
     .readTimeout(20, TimeUnit.SECONDS)
     // The write request times out.
     .writeTimeout(20, TimeUnit.SECONDS)
     // Indicates whether to enable automatic reconnection.
     .retryOnConnectionFailure(true)
     // The connection pool.
     .connectionPool(new ConnectionPool())
     .build();
     }