Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

spring cloud feign – how to find out what http client its using?

We use spring boot open feign with our java 8 spring boot 2.0.3 apps.
Open feign is used to make REST calls to other services.
We are trying to get New Relic java agent to "see" the feign calls as part of traces, but it doesnt instrument them at all.

  1. Is open feign a web client, or is it a library which uses a web client?
  2. How do we find out what web client its using?
  3. how would we change it?

We have been told that new relic only supports the following http clients, we can only guess that feign is not using one of them:

Akka HTTP 2.4.5 to latest
Akka Http Core from 0.4 to latest
AsyncHttpClient 2.0.0-RC1 to latest
HttpAsyncClient 4.1 to latest
Apache Httpclient from 3.1 to 5.x
java.net.HttpURLConnection
OkHttp 3.6.0 to latest
Ning AsyncHttpClient 1.x
Spring webclient from 5.0.0.release to latest
STTP v2

This is how we include feign:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>

>Solution :

  1. Is open feign a web client, or is it a library which uses a web
    client?

Feign is a REST Client and it use a httpClient.

  1. How do we find out what web client its using?
  2. how would we change it?

Look at you application.yaml

Search for something like:
feign.*client.enable=true

A second way to define the client is with Annotation:

@ConditionalOnProperty(value = "feign.httpclient.enabled", matchIfMissing = true) // enables Apache httpClient

But most likely you didn’t define it. Than it’s the default:

java.net.HttpURLConnection

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading