0

I'm working on a Spring Boot project with spring-boot-starter-quartz and recently I have added spring-cloud-starter-sleuth to add traceId for each request. However, when a job is automatically triggered by the system, it cannot propagate traceId like when calling action in controllers or services. Do I have to customise sleuth logging or something else to propagate the traceId to other services ?

Sample: When I normally call in controller, sleuth works fine and I have traceId propagated to other services

2020-06-03 14:37:02.148 [my-scheduler,1966e2d37a2d7713,1966e2d37a2d7713] JobSchedulerController.startScheduleJob:97 17812 --- [nio-8201-exec-3] c.p.s.controller.JobSchedulerController  : Started scheduler job with id 2

However, when my job is automatically trigggered, no traceId is propagated, hence other services will not have that traceId as well.

2020-06-03 14:37:02.219 [my-scheduler,,] JobListener.jobToBeExecuted:30 17812 --- [ryBean_Worker-2] c.p.s.listener.JobListener        : DEFAULT.SampleJob is going to start...
Son Nguyen
  • 13
  • 7

1 Answers1

0

I have solved the problem by upgrading to spring-boot-starter-parent 2.3.0.RELEASE with spring-cloud-dependencies Hoxton.SR5

Son Nguyen
  • 13
  • 7