每个人!我在使用 RSocket RPC 和 Jaeger 时遇到问题。我正在使用这些依赖项
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.6</version>
<opentracing.jaeger.version>2.0.3</opentracing.jaeger.version>
<opentracing-api.version>0.32.0</opentracing-api.version>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-rsocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
<version>${opentracing-api.version}</version>
</dependency>
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-jaeger-cloud-starter</artifactId>
<version>${opentracing.jaeger.version}</version>
<exclusions>
<exclusion>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
</exclusion>
</exclusions>
</dependency>
客户端的 RSocket 通信调用:
return rSocketClient.source()
.flatMap(rSocket -> new IdentityProviderRSocketClient(rSocket, tracer)
.checkClientProfile(request))
.etc
沟通成功。但是,不会添加跟踪所需的元数据。Jaeger 分别在每个服务中接收 span 和 log 消息。 我得到异常(客户端):
Error when injecting SpanContext into carrier. Handling gracefully.
java.lang.ClassCastException:类 io.opentracing.propagation.TextMapInjectAdapter 不能转换为类 io.opentracing.propagation.TextMap(io.opentracing.propagation.TextMapInjectAdapter 和 io.opentracing.propagation.TextMap 位于加载程序的未命名模块中 'app ') 在 io.jaegertracing.internal.propagation.B3TextMapCodec.inject(B3TextMapCodec.java:50) ~[jaeger-core-0.35.1.jar:0.35.1] 在 io.jaegertracing.internal.PropagationRegistry$ExceptionCatchingInjectorDecorator.inject( PropagationRegistry.java:75) ~[jaeger-core-0.35.1.jar:0.35.1] at io.jaegertracing.internal.JaegerTracer.inject(JaegerTracer.java:207) ~[jaeger-core-0.35.1.jar :0.35.1] 在 io.rsocket.ipc.tracing.SpanSubscriber.(SpanSubscriber.java:122) ~[rsocket-ipc-core-0.3.0.jar:na] 在 io.rsocket.ipc.tracing.Tracing。 lambda$null$0(Tracing.java:137) ~[rsocket-ipc-core-0.3.0.jar:na] 在 reactor.core.publisher.Operators$LiftFunction.lambda$liftScannable$1(Operators.java:2525) ~[reactor-core-3.4.6.jar:3.4.6] 在 reactor.core.publisher.MonoLift.subscribeOrReturn (MonoLift.java:40) ~[reactor-core-3.4.6.jar:3.4.6] 在 reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57) ~[reactor-core-3.4.6. jar:3.4.6] 在 reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157) ~[reactor-core-3.4.6.jar:3.4.6] 在 io.opentracing.contrib.reactor。 TracedSubscriber.lambda$onNext$2(TracedSubscriber.java:69) ~[opentracing-reactor-0.1.0.jar:na] at io.opentracing.contrib.reactor.TracedSubscriber.withActiveSpan(TracedSubscriber.java:95) ~[opentracing- reactor-0.1.0.jar:na] 在 io.opentracing.contrib.reactor.TracedSubscriber.onNext(TracedSubscriber.java:69) ~[opentracing-reactor-0.1.0.jar:na] 在 reactor.core。publisher.Operators$MonoSubscriber.complete(Operators.java:1815) ~[reactor-core-3.4.6.jar:3.4.6] 在 reactor.core.publisher.MonoSupplier.subscribe(MonoSupplier.java:61) ~[reactor -core-3.4.6.jar:3.4.6] 在 reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) ~[reactor-core-3.4.6.jar:3.4.6] 在 reactor.core .publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157) ~[reactor-core-3.4.6.jar:3.4.6] at io.opentracing.contrib.reactor.TracedSubscriber.lambda$onNext$2(TracedSubscriber.java :69) ~[opentracing-reactor-0.1.0.jar:na] at io.opentracing.contrib.reactor.TracedSubscriber.withActiveSpan(TracedSubscriber.java:95) ~[opentracing-reactor-0.1.0.jar:na]在 io.opentracing.contrib.reactor.TracedSubscriber.onNext(TracedSubscriber.java:69) ~[opentracing-reactor-0.1.0.jar:na] 在 reactor.core.publisher.Operators$MonoSubscriber。完成(Operators.java:1815)~[reactor-core-3.4.6.jar:3.4.6] 在 reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:249)~[reactor-core-3.4 .6.jar:3.4.6] 在 io.opentracing.contrib.reactor.TracedSubscriber.lambda$onNext$2(TracedSubscriber.java:69) ~[opentracing-reactor-0.1.0.jar:na] 在 io.opentracing。 contrib.reactor.TracedSubscriber.withActiveSpan(TracedSubscriber.java:95) ~[opentracing-reactor-0.1.0.jar:na] at io.opentracing.contrib.reactor.TracedSubscriber.onNext(TracedSubscriber.java:69) ~[opentracing -reactor-0.1.0.jar:na] ...na] 在 io.opentracing.contrib.reactor.TracedSubscriber.withActiveSpan(TracedSubscriber.java:95) ~[opentracing-reactor-0.1.0.jar:na] 在 io.opentracing.contrib.reactor.TracedSubscriber.onNext(TracedSubscriber. java:69) ~[opentracing-reactor-0.1.0.jar:na] ...na] 在 io.opentracing.contrib.reactor.TracedSubscriber.withActiveSpan(TracedSubscriber.java:95) ~[opentracing-reactor-0.1.0.jar:na] 在 io.opentracing.contrib.reactor.TracedSubscriber.onNext(TracedSubscriber. java:69) ~[opentracing-reactor-0.1.0.jar:na] ...
问题在于 RSocket 和 opentracing-spring-jaeger-cloud-starter 的 opentracing-api 版本不一致。
RSocket 使用 opentracing-api 版本 0.31.0 opentracing-spring-jaeger-cloud-starter 使用 opentracing-api 版本 0.32.0(最新版本 - 0.33.0)
是否有使用新的 opentracing-api 使用 RSocket RPC 和 Jaeger 跟踪的解决方案?