Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.internal.ExperimentalInstrumentationModule;
import java.util.List;

@AutoService(InstrumentationModule.class)
public class OracleUcpInstrumentationModule extends InstrumentationModule {
public class OracleUcpInstrumentationModule extends InstrumentationModule
implements ExperimentalInstrumentationModule {

public OracleUcpInstrumentationModule() {
super("oracle-ucp", "oracle-ucp-11.2");
Expand All @@ -23,4 +25,9 @@ public OracleUcpInstrumentationModule() {
public List<TypeInstrumentation> typeInstrumentations() {
return singletonList(new UniversalConnectionPoolInstrumentation());
}

@Override
public boolean isIndyReady() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,18 @@ public static void onExit(@Advice.This UniversalConnectionPool connectionPool) {
public static class StopAdvice {

@Advice.OnMethodEnter(suppress = Throwable.class)
public static void onEnter(@Advice.Local("otelCallDepth") CallDepth callDepth) {
callDepth = CallDepth.forClass(UniversalConnectionPool.class);
public static CallDepth onEnter() {
CallDepth callDepth = CallDepth.forClass(UniversalConnectionPool.class);
callDepth.getAndIncrement();
return callDepth;
}

@Advice.OnMethodExit(suppress = Throwable.class, onThrowable = Throwable.class)
public static void onExit(
@Advice.This UniversalConnectionPool connectionPool,
@Advice.Local("otelCallDepth") CallDepth callDepth) {
if (callDepth == null || callDepth.decrementAndGet() > 0) {
@Advice.This UniversalConnectionPool connectionPool, @Advice.Enter CallDepth callDepth) {
if (callDepth.decrementAndGet() > 0) {
return;
}

telemetry().unregisterMetrics(connectionPool);
}
}
Expand Down
Loading