Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

@Async Annotated methods

In Spring Cloud Sleuth,

This feature is available for all tracer implementations.

In Spring Cloud Sleuth, It instrument async-related components so that the tracing information is passed between threads. 

Case1 : If we annotate method with @Async,  Current implementation works as below where traceid and spanid is same for async call.



Current Logging Sample
{"logTimeStamp":"2022-05-09T19:49:34.126Z",

"logLevel":"DEBUG",

"traceId":"fa1fe5775ee5c1ef",

"principalId":"cps",

"serviceName":"cps-application",

"message":"data updated event to be published org.onap.cps.event.model.CpsDataUpdatedEvent]",

"spanId":"fa1fe5775ee5c1ef",

"processId":"24032",

"threadName":"qtp1680634575-28",

"class":"o.o.cps.notification.NotificationService"}


Case 2 : We should wrap our@Async annotated method with a @NewSpan annotation or create a new span manually to create child spanid.



Logging with child spanid
{"logTimeStamp":"2022-05-09T19:39:34.386Z",
"logLevel":"DEBUG",
"traceId":"523fcb8a6d412b8f",
"principalId":"cps",
"serviceName":"cps-application",
"message":"Execution time of : DataspaceRepository.getByName() with argument[s] = [NFP-Operational] having result = org.onap.cps.spi.entities.DataspaceEntity@5cc01260 :: 3 ms",
"spanId":"523fcb8a6d412b8f",
"processId":"23536",
"threadName":"qtp1120682507-29",
"class":"org.onap.cps.aop.CpsLoggingAspectService"}

{"logTimeStamp":"2022-05-09T19:39:35.641Z",
"logLevel":"DEBUG",
"traceId":"523fcb8a6d412b8f",
"principalId":"cps",
"serviceName":"cps-application",
"message":"data updated event to be published org.onap.cps.event.model.CpsDataUpdatedEvent]",
"spanId":"32c61a4852fb932f",
"processId":"23536",
"threadName":"qtp1120682507-29",
"class":"o.o.cps.notification.NotificationService"}




  • No labels