2つの非常に単純なSpring-Cloud-Streamアプリケーションがあります。メッセージプロデューサであるService3はバインダーカフカを介してコンシューマであるService4にメッセージを送信します。spring-cloud-streamの追跡ができませんSpring-cloud-sleuthのListener
そして、私は春 - 雲 - 竜を使用してそれらのスパンをトレースします。 Zipkinサーバーでは、Service3のスパンのみが利用可能です。 Service4のスパンは表示されません。
Service3
dependencies { compile('org.springframework.boot:spring-boot-starter-web') compile('org.springframework.boot:spring-boot-starter-thymeleaf') compile('org.springframework.cloud:spring-cloud-starter-sleuth') // Marshal spans over a Spring cloud stream binder compile('org.springframework.cloud:spring-cloud-sleuth-stream') compile('org.springframework.cloud:spring-cloud-stream-binder-kafka') testCompile group: 'junit', name: 'junit', version: '4.11' } @SpringBootApplication public class Service3 { public static void main(String[] args) { SpringApplication.run(Service3.class, args); } } @Controller @EnableBinding(Source.class) public class WebController { @Autowired private Source source; @GetMapping("/srv4") private String getSrv4Info(){ String msg = "Hello Service 4"; this.source.output().send(MessageBuilder.withPayload(msg).build()); return "srv4"; } }
Service4
dependencies { compile('org.springframework.boot:spring-boot-starter-web') compile('org.springframework.cloud:spring-cloud-starter-sleuth') // Marshal spans over a Spring cloud stream binder compile('org.springframework.cloud:spring-cloud-sleuth-stream') compile('org.springframework.cloud:spring-cloud-sleuth-zipkin-stream') compile('org.springframework.cloud:spring-cloud-stream-binder-kafka') runtime('io.zipkin.java:zipkin-autoconfigure-ui') testCompile group: 'junit', name: 'junit', version: '4.11' } @SpringBootApplication @EnableZipkinStreamServer public class Service4 { public static void main(String[] args) { SpringApplication.run(Service4.class, args); } } @EnableBinding(Sink.class) public class MsgReceiver { @StreamListener(Sink.INPUT) private void listen(Message<String> msg){ System.out.println(msg.getPayload()); } }
Servic4 (message consumer) is not traced
私は何を逃したのですか?
は最後に、私は自分のアプリケーションに関連する2の問題を発見しました。 1. @EnalbeZipkinStreamServerのアプリケーションをトレースできませんでした。これは設計上のように見えます。 – RocWay
ええ、それはトレーサをトレースしたくないために設計されています –