Reputation: 127
Is spring-cloud-sleuth compatible with retrofit2?
I know sleuth works out of the box with a spring MVC RestTemplate but I can't find any resource online to know how I can make it works with retrofit2.
Upvotes: 2
Views: 1045
Reputation: 3912
The situation has changed since the previous answers were added. Support for Retrofit with bothOkHttpClient
and Spring WebClient
is now available via Spring Cloud Square. You can find the documentation here. Information about Sleuth support can be found here.
Upvotes: 0
Reputation: 792
you can configure brave's Call.Factory with retrofit with an HttpTracing bean configured by Sleuth and an instance of OkHttp
retrofitBuilder.callFactory(TracingCallFactory.create(httpTracing, okhttp))
https://github.com/openzipkin/brave/blob/master/instrumentation/okhttp3/README.md#tracingcallfactory https://github.com/square/retrofit/blob/63cf3e66c4b661170a34a396e9be8a2a01c0e57f/retrofit/src/main/java/retrofit2/Retrofit.java#L484
Upvotes: 2
Reputation: 11189
Not that I know of, unfortunately. But we're open to receiving feature / pull request so don't hestitate to file one in https://github.com/spring-cloud/spring-cloud-sleuth/
Upvotes: 0