sentry-java
sentry-java copied to clipboard
Track composable functions with @SentryTraceable annotation
Description
Create transactions/spans for @Composable functions annotated with @SentryTraceable, so we can enrich events that pop up within that composable lifetime. The code to measure that could roughly look like this:
DisposableEffect(Unit) {
Log.e("SENTRY", "ENTERED COMPOSITION")
onDispose {
Log.e("SENTRY", "LEFT COMPOSITION")
}
}
Would require bytecode manipulation through SAGP.
@romtsn The Java SDK already has such annotations https://github.com/getsentry/sentry-java/blob/main/sentry-spring/src/main/java/io/sentry/spring/tracing/SentryTransaction.java In case the target and retention match, we could e.g. move it to the core package.
Also, we'd probably need this to correctly measure the App Startup/Screen TTID, because onResume currently doesn't give you the correct value when the composable is actually rendered. Not sure how to detect it automatically yet, but we'd need to find a way where to place this code snippet