quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.73k stars 2.67k forks source link

quartz job identifier not set as span name with quartz scheduler OTel tracing #39703

Open syr opened 6 months ago

syr commented 6 months ago

Describe the bug

Based on https://quarkus.io/guides/quartz#scheduling-jobs-programmatically I try to get the quartz job identifier logged with using configs:

quarkus.scheduler.tracing.enabled=true 
quarkus.log.console.format=%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, spanName=%X{spanName}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n

I addded a Log.info("SqsSendJob.execute") output, where I see that traceId and spanId are set, but no span name (quart job id). Also in there MDC there is no further data

15:27:17 INFO  traceId=948f1a1b6daf76f8e5d421915aa0420c, parentId=, spanId=766c372b56b44e0b, spanName=, sampled=true [or.ac.qu.TaskBean$SqsSendJob] (QuarkusQuartzScheduler_Worker-2) SqsSendJob.execute

15:27:27 INFO  traceId=de560d857f36cf01068c32541a7bf4b9, parentId=, spanId=e1d496bbc2016f2f, spanName=, sampled=true [or.ac.qu.TaskBean$SqsSendJob] (QuarkusQuartzScheduler_Worker-3) MDC: {spanId=e1d496bbc2016f2f, traceId=de560d857f36cf01068c32541a7bf4b9, sampled=true}

Referring to https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.7#scheduler---opentelemetry-tracing the span name should be set.

Expected behavior

15:53:38 INFO traceId=f73c70e7207278b39705cf73e4f3adba, parentId=, spanId=c818790e2505de42, spanName=myJob, sampled=true [or.ac.qu.TaskBean$SqsSendJob] (QuarkusQuartzScheduler_Worker-1) SqsSendJob.execute

Actual behavior

15:53:38 INFO traceId=f73c70e7207278b39705cf73e4f3adba, parentId=, spanId=c818790e2505de42, spanName=, sampled=true [or.ac.qu.TaskBean$SqsSendJob] (QuarkusQuartzScheduler_Worker-1) SqsSendJob.execute

How to Reproduce?

https://github.com/syr/quarkus-resteasy-postgres/tree/otel_quartz_3.8

Output of uname -a or ver

No response

Output of java -version

openjdk version "21.0.2" 2024-01-16 LTS OpenJDK Runtime Environment Zulu21.32+17-CA (build 21.0.2+13-LTS) OpenJDK 64-Bit Server VM Zulu21.32+17-CA (build 21.0.2+13-LTS, mixed mode, sharing)

Quarkus version or git rev

3.8.3

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

quarkus-bot[bot] commented 6 months ago

/cc @brunobat (tracing), @machi1990 (quartz), @manovotn (quartz,scheduler), @mkouba (quartz,scheduler), @radcortez (tracing)