3

我在用着

<dependency>
    <groupId>org.lognet</groupId>
    <artifactId>grpc-spring-boot-starter</artifactId>
    <version>2.1.4</version>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>io.zipkin.brave</groupId>
    <artifactId>brave-instrumentation-grpc</artifactId>
    <version>4.13.1</version>
</dependency>

<dependency>
    <groupId>io.zipkin.brave</groupId>
    <artifactId>brave</artifactId>
    <version>4.13.1</version>
</dependency>

我想使用brave-instrumentation-grpc 监控我的grpc 服务器应用程序。所以我遵循了以下建议:

https://github.com/LogNet/grpc-spring-boot-starter#interceptors-support

https://github.com/openzipkin/brave/tree/master/instrumentation/grpc

@Configuration
public class GrpcFilterConfig{

    @GRpcGlobalInterceptor
    @Bean
    public ServerInterceptor globalInterceptor(){
        Tracing tracing = Tracing.newBuilder().build();
        GrpcTracing grpcTracing = GrpcTracing.create(tracing);
        return grpcTracing.newServerInterceptor();
    }
}

问题是:我定义的 GlobalInterceptor 没有绑​​定到 grpcserver。

debug deep insde GRpcServerRunner.class,似乎代码没有返回 beansWithAnnotation

Map<String, Object> beansWithAnnotation = this.applicationContext.getBeansWithAnnotation(annotationType);

beansWithAnnotation 为空。

我的用法有问题吗?

4

0 回答 0