open-telemetry / opentelemetry-java-instrumentation

OpenTelemetry auto-instrumentation and instrumentation libraries for Java
https://opentelemetry.io
Apache License 2.0
1.92k stars 840 forks source link

xxl-job add job thread #10949

Open lrwh opened 6 months ago

lrwh commented 6 months ago

Is your feature request related to a problem? Please describe.

The output information of job thread logs does not have link information. Job thread is part of the job. Can its logs be bound to the link。

57218a64b49058cb482fdcbba33bd33a 998deae337fab33c[${APP_GROUP}][xxl-job-executor-sample-springboot][2024-03-25 16:24:22.354][INFO ][cloudt:][requestId:] [threadId:] [traceId-xxl-job, EmbedServer bizThreadPool-556567184raceId] [service:] [trace_id:] [span_id:] com.xxl.job.core.biz.impl.ExecutorBizImpl.run(ExecutorBizImpl.java:50) - >> do ExecutorBizImpl run
57218a64b49058cb482fdcbba33bd33a 998deae337fab33c[${APP_GROUP}][xxl-job-executor-sample-springboot][2024-03-25 16:24:22.356][INFO ][cloudt:][requestId:] [threadId:] [traceId-xxl-job, EmbedServer bizThreadPool-556567184raceId] [service:] [trace_id:] [span_id:] com.xxl.job.core.biz.impl.ExecutorBizImpl.run(ExecutorBizImpl.java:152) - pushResult : null
 [${APP_GROUP}][xxl-job-executor-sample-springboot][2024-03-25 16:24:22.356][INFO ][cloudt:][requestId:] [threadId:] [traceId-xxl-job, JobThread-1-1711355024780raceId] [service:] [trace_id:] [span_id:] com.xxl.job.core.thread.JobThread.run(JobThread.java:131) - >> thread jobid:1
c104939faab53172e9a69235ed7bbf7d 5c2b248aa2614014[${APP_GROUP}][xxl-job-executor-sample-springboot][2024-03-25 16:24:22.361][INFO ][cloudt:][requestId:] [threadId:] [traceId-http-nio-8081-exec-2raceId] [service:] [trace_id:] [span_id:] com.xxl.job.executor.mvc.controller.IndexController.second(IndexController.java:37) - do second success
c104939faab53172e9a69235ed7bbf7d 8d9592575f167ca9[${APP_GROUP}][xxl-job-executor-sample-springboot][2024-03-25 16:24:22.364][INFO ][cloudt:][requestId:] [threadId:] [traceId-xxl-job, JobThread-1-1711355024780raceId] [service:] [trace_id:] [span_id:] com.xxl.job.executor.service.jobhandler.SampleXxlJob.demoJobHandler(SampleXxlJob.java:51) - body:do second success
c104939faab53172e9a69235ed7bbf7d 8d9592575f167ca9[${APP_GROUP}][xxl-job-executor-sample-springboot][2024-03-25 16:24:22.364][INFO ][cloudt:][requestId:] [threadId:] [traceId-xxl-job, JobThread-1-1711355024780raceId] [service:] [trace_id:] [span_id:] com.xxl.job.executor.service.jobhandler.SampleXxlJob.demoJobHandler(SampleXxlJob.java:52) - this is demoJobHandler

Among them, com.xxl.job.core.thread.JobThread.run(JobThread.java:131) - >> thread jobid:1 is missing the link part

Describe the solution you'd like

Expect jobthread related logs to also be added to link information

Describe alternatives you've considered

Expect jobthread related logs to also be added to link information

Additional context

No response

steverao commented 6 months ago

The output information of job thread logs does not have link information.

Sorry, I didn't understand what the link information is clearly. Can you explain more about your demand and tell us why you want the extra information?

lrwh commented 6 months ago

JobThread is a single thread that divides job admin and job exec (executor) into two. The jobThread thread log information cannot obtain the traceid, and the link information is not passed down.

123liuziming commented 5 months ago

JobThread is a single thread that divides job admin and job exec (executor) into two. The jobThread thread log information cannot obtain the traceid, and the link information is not passed down.

Each JobThread has a IJobHandler, the actual task is executed in IJobHandler, you can obtain the traceid in IJobHandler.