liunancun opened a new issue, #11650:
URL: https://github.com/apache/dubbo/issues/11650
A应用代码和配置
```
dubbo.application.name=demo-consumer
dubbo.scan.basePackages=com.example.demo
dubbo.registry.address=zookeeper://192.168.99.214:2181
dubbo.application.qos-enable=false
dubbo.protocol.port=20881
dubbo.consumer.filter=tracing
```
```
@Configuration
@Import({ DelegatingTracingFilter.class,
SpanCustomizingAsyncHandlerInterceptor.class })
public class WebZipkinConfig implements WebMvcConfigurer {
@Resource
private SpanCustomizingAsyncHandlerInterceptor interceptor;
@Resource
private Tracing tracing;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(interceptor);
}
@Bean
public HttpTracing httpTracing() {
return HttpTracing.create(tracing);
}
}
```
```
@Configuration
public class ZipkinConfig {
@Bean
public Tracing tracing() {
return Tracing.newBuilder().localServiceName("consumer")
.addSpanHandler(
AsyncZipkinSpanHandler.create(OkHttpSender.create("http://192.168.99.214:9411/api/v2/spans")))
.build();
}
}
```
```
@SpringBootApplication
@RestController
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@DubboReference
private DemoService demoService;
@GetMapping("hello")
public String hello() {
demoService.hello("liunancun");
return "hello";
}
}
```
B应用配置和代码
```
dubbo.application.name=demo-provider
dubbo.scan.basePackages=com.example.demo
dubbo.registry.address=zookeeper://192.168.99.214:2181
dubbo.protocol.port=20882
dubbo.provider.filter=tracing
dubbo.consumer.filter=tracing
```
```
@Configuration
public class ZipkinConfig {
@Bean
public Tracing tracing() {
return Tracing.newBuilder().localServiceName("provider")
.addSpanHandler(
AsyncZipkinSpanHandler.create(OkHttpSender.create("http://192.168.99.214:9411/api/v2/spans")))
.build();
}
}
```
```
@DubboService
public class DemoServiceImpl implements DemoService {
@DubboReference
private TestService testService;
@Override
public String hello(String name) {
System.out.println("hello " + name);
testService.test(name);
return "hello " + name;
}
}
```
C应用配置和代码
```
dubbo.application.name=demo-test
dubbo.scan.basePackages=com.example.demo
dubbo.registry.address=zookeeper://192.168.99.214:2181
dubbo.protocol.port=20883
dubbo.provider.filter=tracing
```
```
@Configuration
public class ZipkinConfig {
@Bean
public Tracing tracing() {
return Tracing.newBuilder().localServiceName("test")
.addSpanHandler(
AsyncZipkinSpanHandler.create(OkHttpSender.create("http://192.168.99.214:9411/api/v2/spans")))
.build();
}
}
```
```
@DubboService
public class TestServiceImpl implements TestService {
@Override
public String test(String name) {
System.out.println("test, " + name);
return "test, " + name;
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]