sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

`@SentryCheckIn` always starts a new trace

Open adinauer opened this issue 1 month ago • 3 comments

Integration

sentry

Java Version

any

Version

8.27.1

Steps to Reproduce

https://github.com/getsentry/sentry-java/blob/3699cd5331a4c334c1e8a4bd85aa8e399f5c4231/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/CustomJob.java#L14 creates a transaction.

https://github.com/getsentry/sentry-java/blob/4c4fed9ef005ffc3acaf460ed345c1e700fdeefe/sentry-spring-7/src/main/java/io/sentry/spring7/checkin/SentryCheckInAdvice.java#L91 starts a new trace.

Use our Spring Boot 4 sample to verify.

Expected Result

PropagationContext trace ID matches the transactions trace ID.

Actual Result

PropagationContext trace ID differs from the transactions trace ID.

This might not have any effect in practice because we should be using the span/transaction when retrieving the trace ID.

adinauer avatar Dec 02 '25 09:12 adinauer

JAVA-260

linear[bot] avatar Dec 02 '25 09:12 linear[bot]

Related to: https://sentry.zendesk.com/agent/tickets/168651

masinette avatar Dec 03 '25 20:12 masinette

Just for reference we are now using io.sentry.util.CheckInUtils#withCheckIn(java.lang.String, java.util.concurrent.Callable<U>) to handle the checkin to sentry as we have the same code run under different cron monitor and so can't use the annontations.

buckett avatar Dec 04 '25 14:12 buckett