Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace ID is not passed down in Dubbo application #1363

Open
liunancun opened this issue Feb 24, 2023 · 3 comments
Open

Trace ID is not passed down in Dubbo application #1363

liunancun opened this issue Feb 24, 2023 · 3 comments
Labels

Comments

@liunancun
Copy link

This is a Dubbo application, which consists of three parts: demo-consumer, demo-provider, and demo-test.

The calling process is
demo-consumer -> demo-provider -> demo-test

demo-consumer Configuration and code

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=20883
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";
	}
}

demo-provider Configuration and code

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;
	}

}

demo-test Configuration and code

dubbo.application.name=demo-test
dubbo.scan.basePackages=com.example.demo
dubbo.registry.address=zookeeper://192.168.99.214:2181
dubbo.protocol.port=20881
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;
	}

}

result

Three Trace IDs appear
image

There are only two calls to consumer. Normally, there should be three calls
image

@liunancun liunancun added the bug label Feb 24, 2023
@jcchavezs
Copy link
Contributor

jcchavezs commented Feb 25, 2023 via email

@liunancun
Copy link
Author

It is normal in version 2.7, but there is a problem in version 3 or above. Does it still not support Dubbo3?

@marcingrzejszczak
Copy link
Contributor

Dubbo has support for micrometer observation and micrometer tracing that has a bridge for brave. You can use that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants