Skip to content

Commit 52e27e8

Browse files
committed
review feedback
1 parent 684218f commit 52e27e8

File tree

1 file changed

+8
-3
lines changed
  • dd-java-agent/instrumentation/kotlin-coroutines/src/main/java/datadog/trace/instrumentation/kotlin/coroutines

1 file changed

+8
-3
lines changed

dd-java-agent/instrumentation/kotlin-coroutines/src/main/java/datadog/trace/instrumentation/kotlin/coroutines/CoroutineContextHelper.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010
import kotlinx.coroutines.JobNode;
1111
import kotlinx.coroutines.JobSupport;
1212
import org.jetbrains.annotations.Nullable;
13+
import org.slf4j.Logger;
14+
import org.slf4j.LoggerFactory;
1315

1416
public class CoroutineContextHelper {
17+
private static final Logger log = LoggerFactory.getLogger(CoroutineContextHelper.class);
18+
1519
/*
1620
IntelliJ shows a warning here for Job being out of bounds, but that's not true, the class compiles.
1721
*/
18-
1922
@Nullable
2023
@SuppressWarnings("unchecked")
2124
public static Job getJob(final CoroutineContext context) {
@@ -73,7 +76,8 @@ public static void closeScopeStateContext(final AbstractCoroutine<?> coroutine)
7376
// Kotlin coroutines 1.3
7477
parentHandleField = lookup.findGetter(JobSupport.class, "parentHandle", ChildHandle.class);
7578
jobField = lookup.findGetter(JobNode.class, "job", Job.class);
76-
} catch (Throwable ignored) {
79+
} catch (Throwable e) {
80+
log.debug("Unable to access parent handle", e);
7781
}
7882
}
7983

@@ -93,7 +97,8 @@ private static Job getParentJob(JobSupport coroutine) {
9397
if (parentHandle instanceof JobNode) {
9498
return (Job) JOB_FIELD.invoke((JobNode) parentHandle);
9599
}
96-
} catch (Throwable ignore) {
100+
} catch (Throwable e) {
101+
log.debug("Unable to extract parent job", e);
97102
}
98103
return null;
99104
}

0 commit comments

Comments
 (0)