0

I am playing with quarkus and jaeger by opentracing integration. After run the jaeger server and the https://github.com/quarkusio/quarkus-quickstarts/tree/master/opentracing-quickstart repo I found the traces at http://localhost:16686/search. But I only found the Resource class, arguments, and Process name , but the "Logs" is not shown on trace detail expand.

The steps are easy:

1.Run jaeger server docker run --rm=true --name erp_jaeger_server -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 -p 5775:5775/udp -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 14268:14268 -p 9411:9411 jaegertracing/all-in-one:latest

  1. clone the example repo and run it https://github.com/quarkusio/quarkus-quickstarts/tree/master/opentracing-quickstart (no further configuration)

  2. run-> mvn quarkus:dev

  3. visit http://localhost:8080/hello/

5.Explore on jaeger ui 'http://localhost:16686/'

6.Found the traces Tags, and Process Details but detailes content Log.info('hello') is not shown enter image description here

I was trying with @Slfj but i got the same result

Thanks in advance.

danipenaperez
  • 583
  • 5
  • 12
  • Are you expecting the Quarkus logs to be present within the trace detail? I don't think that's possible with the current implementation, traces aren't correlated to logs – Ken Aug 28 '20 at 15:07

2 Answers2

1

By default, OpenTracing doesn't log automatically into span logs, only important messages that Jaeger feels it needs to be logged and is needed for tracing would be there :). The idea is to separate responsibilities between Tracing and Log management, Check this GitHub discussion.

An alternative would be to use centralized log management and print traceId & spanId into your logs for troubleshooting and correlating logs and tracing.

iabughosh
  • 481
  • 5
  • 19
  • Thanks iabughosh, i think so. But I think its hard to mainaint 2 systems, one for tracing and other for log management. Reading more documentation, I found that you can work with tracer span object to add logs that will be associated to the current request. see https://opentracing.io/guides/java/spans/ . thanks for pointing me in the right direction – danipenaperez Aug 31 '20 at 07:32
  • Firstly, glad to help :). Secondly, It is up to you to choose the approach for this. Sending logs to a different logging system could help you to do more functionalities like log analytics and creating dashboard from them (which is essentials these days) and it will lower the load on Jaeger. – iabughosh Aug 31 '20 at 10:14
  • Yes, seems that Jaeger is focused on profiling and monitoring not for logging. Thanks again. – danipenaperez Aug 31 '20 at 10:24
0

As iabughosh said, the main focus on jaeger is traceability, monitoring and performance, not for logging.

Anyway, i found that using the @traced Bean injection you can insert a tag into the current span, that will be printed on Jaeger UI. this example will added the first 4 lines of an excpetion to the Tags seccion. (I use it on my global ExceptionHandler to add more info about the error):

public abstract class MyExceptionHandler {

@Inject
io.opentracing.Tracer tracer;
/**
 * Will trace the message at jaeger metrics service, only for monitoring and profiling use, not for Logger.
 * @param e
 */
protected void monitorTrace(Exception e) {
    if(tracer!= null && e!=null) {
        StringBuffer sb = new StringBuffer();
        sb.append(e.getCause()+ "\n");
        int deep = 3;
        
        for(int i=0; i< deep;i++) {
            sb.append(e.getStackTrace()[i]+ "\n");
        }
        tracer.activeSpan().setTag("stack ",sb.toString());
    }
}

}

and you will see the little stacktrace at JaegerUI.

enter image description here

Hope helps

danipenaperez
  • 583
  • 5
  • 12