Skip to content

Add @ConditionalOnMissingBean annotation in GrpcClientObservationAutoConfiguration class #246

@bloodyt3ars

Description

@bloodyt3ars

In the autoconfiguration class org.springframework.grpc.autoconfigure.client.GrpcClientObservationAutoConfiguration an ObservationGrpcClientInterceptor is created. This Interceptor is annotated with @GlobalClientInterceptor. That is, under the conditions specified on the class, this Interceptor will always be created and will be included in all channels. It has a setCustomConvention method, but to use it, you need to create a new instance and manually add сustom сonvention there.

I proposal adding a @ConditionalOnMissingBean annotation to this method so that a custom convention can be configured if needed.

An example of how I would like to use this:

    @Bean
    @GlobalClientInterceptor
    ObservationGrpcClientInterceptor observationGrpcClientInterceptor(
            ObservationGrpcClientInterceptor interceptor) {
        interceptor.setCustomConvention(new CustomGrpcClientObservationConvention());
        return interceptor;
    }

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