Skip to content

Tracing Only Works for @LoadBalanced OkHttpClient.Builder Beans #55

@rsteppac

Description

@rsteppac

Describe the bug
spring-cloud-square-okhttp version 0.4.1

Auto-configuration of the org.springframework.cloud.square.okhttp.tracing.TracingOkHttpInterceptor only works if the client builder bean has been annotated with @LoadBalanced: OkHttpBuilderBeanPostProcessor.java#L42

Tracing and load balancing should work independently of each other.

Sample

@Configuration
class SampleContext {

    @Bean
    @LoadBalanced // Drop the annotation and tracing headers will no longer be added to the request
    fun okHttpClientBuilder() : OkHttpClient.Builder = OkHttpClient.Builder()

    @Bean
    fun okHttpClient(builder: OkHttpClient.Builder): OkHttpClient = builder.build()

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions