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

Reevaluate traceId generation places

Open stefanosiano opened this issue 3 months ago • 3 comments

Description

There is an "issue" with ANRs not having the same traceId of the currently running transaction, if the transaction finishes right before the ANR occurs.

This is due to our TWP implementation. Should we change it? It would mean to either

  • understand if an anr is likely going to occur and don't overwrite the stored traceId when the current span finishes
  • replace the traceId stored from spans only after at least 5 seconds, ensuring that the traceId stored in the PersistingScopeObserver is used only by ANRs

stefanosiano avatar Aug 28 '25 14:08 stefanosiano

I think the implementation in the core SDK works correctly, so we might want to add some special logic just for ANRs.

lcian avatar Sep 01 '25 08:09 lcian

We could also utilize span-links to at least connect different traces, allowing the user to see previous traces and e.g. connected logs.

markushi avatar Sep 10 '25 12:09 markushi