0

I'm learning how to track my distributed processes through all the microservices. I've been playing with Sleuth, Zipkin and different microservices, and it works fantastic! But when I try to do the same in a project interacting between the different dependencies I can not create the same behavior.

This image show how currently is working different microservices. enter image description here

This is the diagram of microservices: enter image description here

And this image show how works an application with dependencies. enter image description here

This is the diagram of application with dependencies: enter image description here

I wonder, is it possible to create the same behavior using dependencies as with microservices?

JUAN CALVOPINA M
  • 3,695
  • 2
  • 21
  • 37

2 Answers2

0

Yes, when you create a span you can set the service name. Just call newSpan.remoteServiceName(...)

Marcin Grzejszczak
  • 10,624
  • 1
  • 16
  • 32
  • I'm not using a custom span, only default values I mean I've set the property `spring.application.name` in each service to show their names... I will try to create a Span... – JUAN CALVOPINA M Sep 25 '18 at 15:54
  • I did not find a way to make it work with the `remoteServiceName` method, do you have an example? – JUAN CALVOPINA M Oct 06 '18 at 18:25
0

Taking the input of @MarcinGrzejszczak as reference, I resolved using a custom span:

Span remoteDependency = tracer.nextSpan()
                              .name("dependency_name") 
                              .start();

Where tracer is an autowired object from Trace:

@Autowired
private Tracer tracer;

Both classes are in brave package

import brave.Span;
import brave.Tracer;

Result:

Sample

If you want to take a look at the implementation in more detail, here is the sample: https://github.com/juanca87/sample-traceability-microservices

JUAN CALVOPINA M
  • 3,695
  • 2
  • 21
  • 37