Skip to content

Commit b745c9e

Browse files
authored
Indy-ready - quartz (#15125)
1 parent 0a9ff3f commit b745c9e

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

instrumentation/quartz-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/quartz/v2_0/QuartzInstrumentation.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@ public void transform(TypeTransformer transformer) {
3939
public static class ConstructorAdvice {
4040

4141
@Advice.OnMethodEnter(suppress = Throwable.class)
42-
public static void trackCallDepth(@Advice.Local("otelCallDepth") CallDepth callDepth) {
43-
callDepth = CallDepth.forClass(Scheduler.class);
42+
public static CallDepth trackCallDepth() {
43+
CallDepth callDepth = CallDepth.forClass(Scheduler.class);
4444
callDepth.getAndIncrement();
45+
46+
return callDepth;
4547
}
4648

4749
@Advice.OnMethodExit(suppress = Throwable.class)
4850
public static void addTracingInterceptor(
49-
@Advice.This Scheduler scheduler, @Advice.Local("otelCallDepth") CallDepth callDepth) {
51+
@Advice.This Scheduler scheduler, @Advice.Enter CallDepth callDepth) {
5052
// No-args constructor is automatically called by constructors with args, but we only want to
5153
// run once from the constructor with args because that is where the dedupe needs to happen.
5254
if (callDepth.decrementAndGet() > 0) {

instrumentation/quartz-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/quartz/v2_0/QuartzInstrumentationModule.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
import com.google.auto.service.AutoService;
99
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
1010
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
11+
import io.opentelemetry.javaagent.extension.instrumentation.internal.ExperimentalInstrumentationModule;
1112
import java.util.Collections;
1213
import java.util.List;
1314

1415
@AutoService(InstrumentationModule.class)
15-
public class QuartzInstrumentationModule extends InstrumentationModule {
16+
public class QuartzInstrumentationModule extends InstrumentationModule
17+
implements ExperimentalInstrumentationModule {
1618

1719
public QuartzInstrumentationModule() {
1820
super("quartz", "quartz-2.0");
@@ -22,4 +24,9 @@ public QuartzInstrumentationModule() {
2224
public List<TypeInstrumentation> typeInstrumentations() {
2325
return Collections.singletonList(new QuartzInstrumentation());
2426
}
27+
28+
@Override
29+
public boolean isIndyReady() {
30+
return true;
31+
}
2532
}

0 commit comments

Comments
 (0)