Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make hibernate-* indy compatible #11553

Merged
merged 8 commits into from
Aug 22, 2024
Merged

Conversation

SylvainJuge
Copy link
Contributor

Part of #11457

  • needs to have a common classloader for all hibernate instrumentation modules
  • is using @Advice.Local

Introduces HibernateOperationScope class to carry the state between enter and exit advice (and also helps to reduce a bit code duplication).

"indy compatible" is defined in https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11546/files#diff-c01c02c7d6cde11986ed4c95f749da6318b0deb89c371d866319371cc1757bd0

This PR needs to have the indy test label added for validation in CI.
Local validation can be done with gradle test -PtestIndy=true

@SylvainJuge SylvainJuge requested a review from a team June 11, 2024 17:10
SylvainJuge added a commit to SylvainJuge/opentelemetry-java-instrumentation that referenced this pull request Jun 11, 2024
@SylvainJuge
Copy link
Contributor Author

@trask can you add test indy label to this PR ?

@trask
Copy link
Member

trask commented Jun 13, 2024

closing and re-opening to trigger indy tests

@trask trask closed this Jun 13, 2024
@trask trask reopened this Jun 13, 2024
@laurit
Copy link
Contributor

laurit commented Jul 9, 2024

I think you should split this PR in 2. The first one should just do the changes that are needed to make the instrumentation work with indy like adding the getModuleGroup (assuming this all that is needed for that). This PR could be merged immediately. In the second PR you could explore the options for rewriting the advice in a way that would work without inlining the advice, like removing @Advice.Local and erasing the type for @Advice.Enter. This PR will probably need more time as there will be cases where the indy version is clearly worse than what we have currently (for example the need to erase the type for @Advice.Enter). This will definitely raise questions like can we do something to get the type back? Can we rewrite the advice in a way where the loss of type doesn't matter. For example perhaps we should write the advice like

@Advice.OnMethodEnter(suppress = Throwable.class)
public static Consumer<Throwable> startMethod(@Advice.This ProcedureCall call, @Advice.Origin("#m") String name) {
  return ProcedureCallMethodHelper.start(call, name);
}

@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
public static void endMethod(@Advice.Thrown Throwable throwable, @Advice.Enter Consumer<Throwbale> exitAction) {
  if (exitAction != null) {
    exitAction.accept(throwable);
  }
}

and move all the logic that we have in advice into the helper. The returned Consumer instance can have CallDepth as field so you won't need to add any casts.

@SylvainJuge
Copy link
Contributor Author

I think you should split this PR in 2. The first one should just do the changes that are needed to make the instrumentation work with indy like adding the getModuleGroup (assuming this all that is needed for that).

Unfortunately, I think we can't do that, as migrating to indy advices means removing the local variables.

I agree with you that there may be more elegant (and maybe generic) ways to do that, here I tried to minimize the changes to the strictly necessary.

I really like your idea to use a Consumer as a way to avoid the type cast, it could even be possible to do some object pooling in the helper to minimize allocation if needed.

On the long term, once using indy advices everywhere, there isn't any separation needed between helper classes and advice classes, so those helper classes could just be inner classes of the advice class if needed for simplicity.

When we did similar migration in the Elastic APM agent we did similar compromises on the code simplicity as we think the benefits (get rid of shading, being able to debug, isolated classloaders, ...) were definitely worth doing it, however here I completely understand that doing so might be harder to accept, especially given this work will take a while and many releases to be completed.

@trask trask mentioned this pull request Jul 9, 2024
@JonasKunz
Copy link
Contributor

JonasKunz commented Jul 10, 2024

IMO, the Consumer approach for Advices feels a bit more complicated, though it preserves type safety. However this comes at the cost of allocation of which I'm not sure whether the JIT is capable of getting rid of. I'm pretty sure for plain Objects / Object-arrays those are allocation-free after JIT-inlining the Advice code on hot paths.

@laurit if you want to, I can have a try at implementing the approach suggested in this comment to allow references to any types visible to the Advice in it's method signatures if that is important to you:

  • When inserting the invokedynamic, replace all unaccessible types with Object
  • We store the orginial signature before erasure as a String in the constant pool and pass it to the invokedynamic bootstrap method
  • Using this original signature, the invokedynamic bootstrapping method can lookup the MethodHandle for the Advice method and alter it to match the erased signature using the utilities in MethodHandle.asType.

EDIT:

Did a small microbenchmark to verify that MethodHandle.asType does not impact the JIT-ability to inline:

Benchmark code
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@BenchmarkMode(Mode.AverageTime)
public class MethodHandleInlining {

private static final MethodHandle original = createMH();

private static final MethodHandle erased = original.asType(
    MethodType.methodType(Object.class, Object.class));

private static MethodHandle createMH() {
  try {
    return MethodHandles.publicLookup()
        .findStatic(MethodHandleInlining.class, "doStuff",
            MethodType.methodType(Blackhole.class, Blackhole.class));
  } catch (Exception e) {
    throw new IllegalStateException(e);
  }
}

@Benchmark
public void invokeNormal(Blackhole bh) {
  bh.consume(doStuff(bh));
}

@Benchmark
public void invokeOriginalNotExact(Blackhole bh) {
  try {
    bh.consume(original.invoke((Object) bh));
  } catch (Throwable e) {
    throw new IllegalStateException(e);
  }
  bh.consume(doStuff(bh));
}

@Benchmark
public void invokeOriginalExact(Blackhole bh) {
  try {
    bh.consume((Blackhole) original.invokeExact(bh));
  } catch (Throwable e) {
    throw new IllegalStateException(e);
  }
}

@Benchmark
public void invokeErasedExact(Blackhole bh) {
  try {
    bh.consume((Object) erased.invokeExact((Object) bh));
  } catch (Throwable e) {
    throw new IllegalStateException(e);
  }
}

public static Blackhole doStuff(Blackhole bh) {
  bh.consume(bh);
  return bh;
}
}

Results on JDK 17:

Benchmark                                    Mode  Cnt  Score    Error  Units
MethodHandleInlining.invokeErasedExact       avgt    5  0,568 ±  0,001  ns/op
MethodHandleInlining.invokeNormal            avgt    5  0,573 ±  0,027  ns/op
MethodHandleInlining.invokeOriginalExact     avgt    5  0,569 ±  0,011  ns/op
MethodHandleInlining.invokeOriginalNotExact  avgt    5  2,534 ±  0,019  ns/op

So, it seems like MethodHandle.asType is free after JIT. Therefore I'd propose to go that route.

@laurit
Copy link
Contributor

laurit commented Jul 10, 2024

Unfortunately, I think we can't do that, as migrating to indy advices means removing the local variables.

As far as I remember the advice transformer can rewrite @Advice.Local, so while we need to get rid of these eventually it shouldn't be strictly necessary to get tests running with indy.

@laurit
Copy link
Contributor

laurit commented Jul 10, 2024

IMO, the Consumer approach for Advices feels a bit more complicated, though it preserves type safety. However this comes at the cost of allocation of which I'm not sure whether the JIT is capable of getting rid of. I'm pretty sure for plain Objects / Object-arrays those are allocation-free after JIT-inlining the Advice code on hot paths.

Creating a span and exporting it does a lot of things. Adding a few more allocations there isn't really going to change anything. Also many of the existing advices already allocate some objects so I wouldn't worry about this too much. As for the JIT I'd guess whether it can stack allocate something will really depend on whether it can prove with escape analysis whether the object is used only in this method or not. In that regard it should not matter whether it is an object array or something else. What matters is whether this object gets passed to some other method and whether that method gets inlined.

@laurit if you want to, I can have a try at implementing the approach suggested in #11559 (comment) to allow references to any types visible to the Advice in it's method signatures if that is important to you:

I think this could improve the readability of the advice code. It would be awesome if you could look into this.

@SylvainJuge
Copy link
Contributor Author

Thanks to the work of @JonasKunz in #11873 we can have better advice signatures without Object nor casts, so I have updated this PR accordingly.

As a consequence, this PR is now mostly about removing usages of Advice.Local, @laurit could you take a second look at it ?

if (callDepth.getAndIncrement() > 0) {
return;
return HibernateOperationScope.wrapCallDepth(callDepth);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, hibernate does a lot of method overload delegation which leads to fairly heavy usage of the CallDepth checks, it may be worth avoiding these allocations and conditionally returning CallDepth or HibernateOperationScope

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've switched to less wrapping in cd99412, should be better now.

Is there a usual benchmark to measure extra allocation created by the instrumentation/sdk ?

@laurit
Copy link
Contributor

laurit commented Aug 22, 2024

@SylvainJuge I wanted to create a PR for your PR that does this a bit differently, but with your last changes it won't apply cleanly and I don't have time to fix it so I'll just paste the diff here for an alternative idea how you could have solved this (I didn't run all tests so could be buggy).

diff --git a/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/CriteriaInstrumentation.java b/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/CriteriaInstrumentation.java
index 80e57dd549..0fd07613db 100644
--- a/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/CriteriaInstrumentation.java
+++ b/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/CriteriaInstrumentation.java
@@ -14,7 +14,6 @@ import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
 
 import io.opentelemetry.context.Context;
 import io.opentelemetry.instrumentation.api.util.VirtualField;
-import io.opentelemetry.javaagent.bootstrap.CallDepth;
 import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@@ -53,9 +52,8 @@ public class CriteriaInstrumentation implements TypeInstrumentation {
     public static HibernateOperationScope startMethod(
         @Advice.This Criteria criteria, @Advice.Origin("#m") String name) {
 
-      CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
-      if (callDepth.getAndIncrement() > 0) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+      if (HibernateOperationScope.isStarted()) {
+        return null;
       }
 
       String entityName = null;
@@ -70,19 +68,15 @@ public class CriteriaInstrumentation implements TypeInstrumentation {
       Context parentContext = Java8BytecodeBridge.currentContext();
       HibernateOperation hibernateOperation =
           new HibernateOperation("Criteria." + name, entityName, sessionInfo);
-      if (!instrumenter().shouldStart(parentContext, hibernateOperation)) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
-      }
 
-      return HibernateOperationScope.startNew(
-          callDepth, hibernateOperation, parentContext, instrumenter());
+      return HibernateOperationScope.start(hibernateOperation, parentContext, instrumenter());
     }
 
     @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
     public static void endMethod(
-        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope enterScope) {
+        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope scope) {
 
-      HibernateOperationScope.end(enterScope, instrumenter(), throwable);
+      HibernateOperationScope.end(scope, throwable);
     }
   }
 }
diff --git a/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/QueryInstrumentation.java b/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/QueryInstrumentation.java
index 2a72cd5126..d4c170f191 100644
--- a/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/QueryInstrumentation.java
+++ b/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/QueryInstrumentation.java
@@ -15,7 +15,6 @@ import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
 
 import io.opentelemetry.context.Context;
 import io.opentelemetry.instrumentation.api.util.VirtualField;
-import io.opentelemetry.javaagent.bootstrap.CallDepth;
 import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@@ -52,9 +51,8 @@ public class QueryInstrumentation implements TypeInstrumentation {
     @Advice.OnMethodEnter(suppress = Throwable.class)
     public static HibernateOperationScope startMethod(@Advice.This Query query) {
 
-      CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
-      if (callDepth.getAndIncrement() > 0) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+      if (HibernateOperationScope.isStarted()) {
+        return null;
       }
 
       VirtualField<Query, SessionInfo> queryVirtualField =
@@ -64,19 +62,15 @@ public class QueryInstrumentation implements TypeInstrumentation {
       Context parentContext = Java8BytecodeBridge.currentContext();
       HibernateOperation hibernateOperation =
           new HibernateOperation(getOperationNameForQuery(query.getQueryString()), sessionInfo);
-      if (!instrumenter().shouldStart(parentContext, hibernateOperation)) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
-      }
 
-      return HibernateOperationScope.startNew(
-          callDepth, hibernateOperation, parentContext, instrumenter());
+      return HibernateOperationScope.start(hibernateOperation, parentContext, instrumenter());
     }
 
     @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
     public static void endMethod(
-        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope enterScope) {
+        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope scope) {
 
-      HibernateOperationScope.end(enterScope, instrumenter(), throwable);
+      HibernateOperationScope.end(scope, throwable);
     }
   }
 }
diff --git a/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/SessionInstrumentation.java b/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/SessionInstrumentation.java
index b6ce66a58a..b7595ece72 100644
--- a/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/SessionInstrumentation.java
+++ b/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/SessionInstrumentation.java
@@ -19,7 +19,6 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
 
 import io.opentelemetry.context.Context;
 import io.opentelemetry.instrumentation.api.util.VirtualField;
-import io.opentelemetry.javaagent.bootstrap.CallDepth;
 import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@@ -99,9 +98,8 @@ public class SessionInstrumentation implements TypeInstrumentation {
         @Advice.Argument(0) Object arg0,
         @Advice.Argument(value = 1, optional = true) Object arg1) {
 
-      CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
-      if (callDepth.getAndIncrement() > 0) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+      if (HibernateOperationScope.isStarted()) {
+        return null;
       }
 
       Context parentContext = Java8BytecodeBridge.currentContext();
@@ -110,19 +108,15 @@ public class SessionInstrumentation implements TypeInstrumentation {
           getEntityName(descriptor, arg0, arg1, EntityNameUtil.bestGuessEntityName(session));
       HibernateOperation hibernateOperation =
           new HibernateOperation(getSessionMethodOperationName(name), entityName, sessionInfo);
-      if (!instrumenter().shouldStart(parentContext, hibernateOperation)) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
-      }
 
-      return HibernateOperationScope.startNew(
-          callDepth, hibernateOperation, parentContext, instrumenter());
+      return HibernateOperationScope.start(hibernateOperation, parentContext, instrumenter());
     }
 
     @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
     public static void endMethod(
-        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope enterScope) {
+        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope scope) {
 
-      HibernateOperationScope.end(enterScope, instrumenter(), throwable);
+      HibernateOperationScope.end(scope, throwable);
     }
   }
 
diff --git a/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/TransactionInstrumentation.java b/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/TransactionInstrumentation.java
index 52162e48b4..91e83fae8c 100644
--- a/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/TransactionInstrumentation.java
+++ b/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/TransactionInstrumentation.java
@@ -14,7 +14,6 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
 
 import io.opentelemetry.context.Context;
 import io.opentelemetry.instrumentation.api.util.VirtualField;
-import io.opentelemetry.javaagent.bootstrap.CallDepth;
 import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@@ -51,9 +50,8 @@ public class TransactionInstrumentation implements TypeInstrumentation {
     @Advice.OnMethodEnter(suppress = Throwable.class)
     public static HibernateOperationScope startCommit(@Advice.This Transaction transaction) {
 
-      CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
-      if (callDepth.getAndIncrement() > 0) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+      if (HibernateOperationScope.isStarted()) {
+        return null;
       }
 
       VirtualField<Transaction, SessionInfo> transactionVirtualField =
@@ -63,19 +61,15 @@ public class TransactionInstrumentation implements TypeInstrumentation {
       Context parentContext = Java8BytecodeBridge.currentContext();
       HibernateOperation hibernateOperation =
           new HibernateOperation("Transaction.commit", sessionInfo);
-      if (!instrumenter().shouldStart(parentContext, hibernateOperation)) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
-      }
 
-      return HibernateOperationScope.startNew(
-          callDepth, hibernateOperation, parentContext, instrumenter());
+      return HibernateOperationScope.start(hibernateOperation, parentContext, instrumenter());
     }
 
     @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
     public static void endCommit(
-        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope enterScope) {
+        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope scope) {
 
-      HibernateOperationScope.end(enterScope, instrumenter(), throwable);
+      HibernateOperationScope.end(scope, throwable);
     }
   }
 }
diff --git a/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/CriteriaInstrumentation.java b/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/CriteriaInstrumentation.java
index db8d4d379b..ecfe47211c 100644
--- a/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/CriteriaInstrumentation.java
+++ b/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/CriteriaInstrumentation.java
@@ -14,7 +14,6 @@ import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
 
 import io.opentelemetry.context.Context;
 import io.opentelemetry.instrumentation.api.util.VirtualField;
-import io.opentelemetry.javaagent.bootstrap.CallDepth;
 import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@@ -53,9 +52,8 @@ public class CriteriaInstrumentation implements TypeInstrumentation {
     public static HibernateOperationScope startMethod(
         @Advice.This Criteria criteria, @Advice.Origin("#m") String name) {
 
-      CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
-      if (callDepth.getAndIncrement() > 0) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+      if (HibernateOperationScope.isStarted()) {
+        return null;
       }
 
       String entityName = null;
@@ -70,19 +68,15 @@ public class CriteriaInstrumentation implements TypeInstrumentation {
       Context parentContext = Java8BytecodeBridge.currentContext();
       HibernateOperation hibernateOperation =
           new HibernateOperation("Criteria." + name, entityName, sessionInfo);
-      if (!instrumenter().shouldStart(parentContext, hibernateOperation)) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
-      }
 
-      return HibernateOperationScope.startNew(
-          callDepth, hibernateOperation, parentContext, instrumenter());
+      return HibernateOperationScope.start(hibernateOperation, parentContext, instrumenter());
     }
 
     @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
     public static void endMethod(
-        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope enterScope) {
+        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope scope) {
 
-      HibernateOperationScope.end(enterScope, instrumenter(), throwable);
+      HibernateOperationScope.end(scope, throwable);
     }
   }
 }
diff --git a/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/QueryInstrumentation.java b/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/QueryInstrumentation.java
index 5a5e86ebfd..f79f021441 100644
--- a/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/QueryInstrumentation.java
+++ b/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/QueryInstrumentation.java
@@ -15,7 +15,6 @@ import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
 
 import io.opentelemetry.context.Context;
 import io.opentelemetry.instrumentation.api.util.VirtualField;
-import io.opentelemetry.javaagent.bootstrap.CallDepth;
 import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@@ -52,9 +51,8 @@ public class QueryInstrumentation implements TypeInstrumentation {
     @Advice.OnMethodEnter(suppress = Throwable.class)
     public static HibernateOperationScope startMethod(@Advice.This Query query) {
 
-      CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
-      if (callDepth.getAndIncrement() > 0) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+      if (HibernateOperationScope.isStarted()) {
+        return null;
       }
 
       VirtualField<Query, SessionInfo> queryVirtualField =
@@ -64,19 +62,15 @@ public class QueryInstrumentation implements TypeInstrumentation {
       Context parentContext = Java8BytecodeBridge.currentContext();
       HibernateOperation hibernateOperation =
           new HibernateOperation(getOperationNameForQuery(query.getQueryString()), sessionInfo);
-      if (!instrumenter().shouldStart(parentContext, hibernateOperation)) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
-      }
 
-      return HibernateOperationScope.startNew(
-          callDepth, hibernateOperation, parentContext, instrumenter());
+      return HibernateOperationScope.start(hibernateOperation, parentContext, instrumenter());
     }
 
     @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
     public static void endMethod(
-        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope enterScope) {
+        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope scope) {
 
-      HibernateOperationScope.end(enterScope, instrumenter(), throwable);
+      HibernateOperationScope.end(scope, throwable);
     }
   }
 }
diff --git a/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/SessionInstrumentation.java b/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/SessionInstrumentation.java
index 84dca3c724..a4a4417acf 100644
--- a/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/SessionInstrumentation.java
+++ b/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/SessionInstrumentation.java
@@ -19,7 +19,6 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
 
 import io.opentelemetry.context.Context;
 import io.opentelemetry.instrumentation.api.util.VirtualField;
-import io.opentelemetry.javaagent.bootstrap.CallDepth;
 import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@@ -103,9 +102,8 @@ public class SessionInstrumentation implements TypeInstrumentation {
         @Advice.Argument(0) Object arg0,
         @Advice.Argument(value = 1, optional = true) Object arg1) {
 
-      CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
-      if (callDepth.getAndIncrement() > 0) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+      if (HibernateOperationScope.isStarted()) {
+        return null;
       }
 
       VirtualField<SharedSessionContract, SessionInfo> virtualField =
@@ -117,19 +115,15 @@ public class SessionInstrumentation implements TypeInstrumentation {
           getEntityName(descriptor, arg0, arg1, EntityNameUtil.bestGuessEntityName(session));
       HibernateOperation hibernateOperation =
           new HibernateOperation(getSessionMethodOperationName(name), entityName, sessionInfo);
-      if (!instrumenter().shouldStart(parentContext, hibernateOperation)) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
-      }
 
-      return HibernateOperationScope.startNew(
-          callDepth, hibernateOperation, parentContext, instrumenter());
+      return HibernateOperationScope.start(hibernateOperation, parentContext, instrumenter());
     }
 
     @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
     public static void endMethod(
-        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope enterState) {
+        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope scope) {
 
-      HibernateOperationScope.end(enterState, instrumenter(), throwable);
+      HibernateOperationScope.end(scope, throwable);
     }
   }
 
diff --git a/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/TransactionInstrumentation.java b/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/TransactionInstrumentation.java
index dce7dd4a85..a7f1a3b54e 100644
--- a/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/TransactionInstrumentation.java
+++ b/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/TransactionInstrumentation.java
@@ -14,7 +14,6 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
 
 import io.opentelemetry.context.Context;
 import io.opentelemetry.instrumentation.api.util.VirtualField;
-import io.opentelemetry.javaagent.bootstrap.CallDepth;
 import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@@ -51,9 +50,8 @@ public class TransactionInstrumentation implements TypeInstrumentation {
     @Advice.OnMethodEnter(suppress = Throwable.class)
     public static HibernateOperationScope startCommit(@Advice.This Transaction transaction) {
 
-      CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
-      if (callDepth.getAndIncrement() > 0) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+      if (HibernateOperationScope.isStarted()) {
+        return null;
       }
 
       VirtualField<Transaction, SessionInfo> transactionVirtualField =
@@ -63,19 +61,15 @@ public class TransactionInstrumentation implements TypeInstrumentation {
       Context parentContext = Java8BytecodeBridge.currentContext();
       HibernateOperation hibernateOperation =
           new HibernateOperation("Transaction.commit", sessionInfo);
-      if (!instrumenter().shouldStart(parentContext, hibernateOperation)) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
-      }
 
-      return HibernateOperationScope.startNew(
-          callDepth, hibernateOperation, parentContext, instrumenter());
+      return HibernateOperationScope.start(hibernateOperation, parentContext, instrumenter());
     }
 
     @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
     public static void endCommit(
-        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope enterScope) {
+        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope scope) {
 
-      HibernateOperationScope.end(enterScope, instrumenter(), throwable);
+      HibernateOperationScope.end(scope, throwable);
     }
   }
 }
diff --git a/instrumentation/hibernate/hibernate-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v6_0/QueryInstrumentation.java b/instrumentation/hibernate/hibernate-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v6_0/QueryInstrumentation.java
index bc024f3087..12509e8d3c 100644
--- a/instrumentation/hibernate/hibernate-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v6_0/QueryInstrumentation.java
+++ b/instrumentation/hibernate/hibernate-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v6_0/QueryInstrumentation.java
@@ -15,7 +15,6 @@ import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
 
 import io.opentelemetry.context.Context;
 import io.opentelemetry.instrumentation.api.util.VirtualField;
-import io.opentelemetry.javaagent.bootstrap.CallDepth;
 import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@@ -66,9 +65,8 @@ public class QueryInstrumentation implements TypeInstrumentation {
     @Advice.OnMethodEnter(suppress = Throwable.class)
     public static HibernateOperationScope startMethod(@Advice.This CommonQueryContract query) {
 
-      CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
-      if (callDepth.getAndIncrement() > 0) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+      if (HibernateOperationScope.isStarted()) {
+        return null;
       }
 
       String queryString = null;
@@ -90,19 +88,15 @@ public class QueryInstrumentation implements TypeInstrumentation {
       Context parentContext = Java8BytecodeBridge.currentContext();
       HibernateOperation hibernateOperation =
           new HibernateOperation(getOperationNameForQuery(queryString), sessionInfo);
-      if (!instrumenter().shouldStart(parentContext, hibernateOperation)) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
-      }
 
-      return HibernateOperationScope.startNew(
-          callDepth, hibernateOperation, parentContext, instrumenter());
+      return HibernateOperationScope.start(hibernateOperation, parentContext, instrumenter());
     }
 
     @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
     public static void endMethod(
-        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope enterScope) {
+        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope scope) {
 
-      HibernateOperationScope.end(enterScope, instrumenter(), throwable);
+      HibernateOperationScope.end(scope, throwable);
     }
   }
 }
diff --git a/instrumentation/hibernate/hibernate-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v6_0/SessionInstrumentation.java b/instrumentation/hibernate/hibernate-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v6_0/SessionInstrumentation.java
index f0f810c5b9..b5eee5cf2a 100644
--- a/instrumentation/hibernate/hibernate-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v6_0/SessionInstrumentation.java
+++ b/instrumentation/hibernate/hibernate-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v6_0/SessionInstrumentation.java
@@ -19,7 +19,6 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
 
 import io.opentelemetry.context.Context;
 import io.opentelemetry.instrumentation.api.util.VirtualField;
-import io.opentelemetry.javaagent.bootstrap.CallDepth;
 import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@@ -102,9 +101,8 @@ public class SessionInstrumentation implements TypeInstrumentation {
         @Advice.Argument(0) Object arg0,
         @Advice.Argument(value = 1, optional = true) Object arg1) {
 
-      CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
-      if (callDepth.getAndIncrement() > 0) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+      if (HibernateOperationScope.isStarted()) {
+        return null;
       }
 
       VirtualField<SharedSessionContract, SessionInfo> virtualField =
@@ -116,19 +114,15 @@ public class SessionInstrumentation implements TypeInstrumentation {
           getEntityName(descriptor, arg0, arg1, EntityNameUtil.bestGuessEntityName(session));
       HibernateOperation hibernateOperation =
           new HibernateOperation(getSessionMethodOperationName(name), entityName, sessionInfo);
-      if (!instrumenter().shouldStart(parentContext, hibernateOperation)) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
-      }
 
-      return HibernateOperationScope.startNew(
-          callDepth, hibernateOperation, parentContext, instrumenter());
+      return HibernateOperationScope.start(hibernateOperation, parentContext, instrumenter());
     }
 
     @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
     public static void endMethod(
-        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope enterScope) {
+        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope scope) {
 
-      HibernateOperationScope.end(enterScope, instrumenter(), throwable);
+      HibernateOperationScope.end(scope, throwable);
     }
   }
 
diff --git a/instrumentation/hibernate/hibernate-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v6_0/TransactionInstrumentation.java b/instrumentation/hibernate/hibernate-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v6_0/TransactionInstrumentation.java
index f82a6882c4..a304331825 100644
--- a/instrumentation/hibernate/hibernate-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v6_0/TransactionInstrumentation.java
+++ b/instrumentation/hibernate/hibernate-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v6_0/TransactionInstrumentation.java
@@ -14,7 +14,6 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
 
 import io.opentelemetry.context.Context;
 import io.opentelemetry.instrumentation.api.util.VirtualField;
-import io.opentelemetry.javaagent.bootstrap.CallDepth;
 import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@@ -51,9 +50,8 @@ public class TransactionInstrumentation implements TypeInstrumentation {
     @Advice.OnMethodEnter(suppress = Throwable.class)
     public static HibernateOperationScope startCommit(@Advice.This Transaction transaction) {
 
-      CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
-      if (callDepth.getAndIncrement() > 0) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+      if (HibernateOperationScope.isStarted()) {
+        return null;
       }
 
       VirtualField<Transaction, SessionInfo> transactionVirtualField =
@@ -64,18 +62,17 @@ public class TransactionInstrumentation implements TypeInstrumentation {
       HibernateOperation hibernateOperation =
           new HibernateOperation("Transaction.commit", sessionInfo);
       if (!instrumenter().shouldStart(parentContext, hibernateOperation)) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+        return null;
       }
 
-      return HibernateOperationScope.startNew(
-          callDepth, hibernateOperation, parentContext, instrumenter());
+      return HibernateOperationScope.start(hibernateOperation, parentContext, instrumenter());
     }
 
     @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
     public static void endCommit(
-        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope enterScope) {
+        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope scope) {
 
-      HibernateOperationScope.end(enterScope, instrumenter(), throwable);
+      HibernateOperationScope.end(scope, throwable);
     }
   }
 }
diff --git a/instrumentation/hibernate/hibernate-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/HibernateOperationScope.java b/instrumentation/hibernate/hibernate-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/HibernateOperationScope.java
index 96e9dba438..53a8d131c8 100644
--- a/instrumentation/hibernate/hibernate-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/HibernateOperationScope.java
+++ b/instrumentation/hibernate/hibernate-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/HibernateOperationScope.java
@@ -10,80 +10,76 @@ import io.opentelemetry.context.Scope;
 import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
 import io.opentelemetry.javaagent.bootstrap.CallDepth;
 
-public class HibernateOperationScope {
+public final class HibernateOperationScope {
 
-  private final CallDepth callDepth;
+  private final Instrumenter<HibernateOperation, Void> instrumenter;
   private final HibernateOperation hibernateOperation;
   private final Context context;
   private final Scope scope;
 
   private HibernateOperationScope(
-      CallDepth callDepth, HibernateOperation hibernateOperation, Context context, Scope scope) {
-    this.callDepth = callDepth;
+      Instrumenter<HibernateOperation, Void> instrumenter,
+      HibernateOperation hibernateOperation,
+      Context context,
+      Scope scope) {
+    this.instrumenter = instrumenter;
     this.hibernateOperation = hibernateOperation;
     this.context = context;
     this.scope = scope;
   }
 
+  /**
+   * Checks whether there already is an ongoing operation
+   *
+   * @return true if the operation has already been started
+   */
+  public static boolean isStarted() {
+    CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
+    return callDepth.getAndIncrement() > 0;
+  }
+
   /**
    * Starts operation scope
    *
-   * @param callDepth call depth
    * @param hibernateOperation hibernate operation
    * @param parentContext parent context
    * @param instrumenter instrumenter
-   * @return operation scope, to be ended with {@link #end(HibernateOperationScope, Instrumenter,
-   *     Throwable)} on exit advice
+   * @return operation scope, to be ended with {@link #end(HibernateOperationScope, Throwable)} on
+   *     exit advice, or null
    */
-  public static HibernateOperationScope startNew(
-      CallDepth callDepth,
+  public static HibernateOperationScope start(
       HibernateOperation hibernateOperation,
       Context parentContext,
       Instrumenter<HibernateOperation, Void> instrumenter) {
 
+    if (!instrumenter.shouldStart(parentContext, hibernateOperation)) {
+      return null;
+    }
+
     Context context = instrumenter.start(parentContext, hibernateOperation);
     return new HibernateOperationScope(
-        callDepth, hibernateOperation, context, context.makeCurrent());
-  }
-
-  /**
-   * Builds hibernate operation scope from an existing call depth for cases where only the call
-   * depth is needed
-   *
-   * @param callDepth call depth
-   * @return hibernate operation scope wrapping the provided call depth.
-   */
-  public static HibernateOperationScope wrapCallDepth(CallDepth callDepth) {
-    return new HibernateOperationScope(callDepth, null, null, null);
+        instrumenter, hibernateOperation, context, context.makeCurrent());
   }
 
   /**
    * Ends operation scope
    *
-   * @param hibernateOperationScope hibernate operation scope
-   * @param instrumenter instrumenter
+   * @param scope operation scope
    * @param throwable thrown exception
    */
-  public static void end(
-      HibernateOperationScope hibernateOperationScope,
-      Instrumenter<HibernateOperation, Void> instrumenter,
-      Throwable throwable) {
-
-    if (hibernateOperationScope.context == null) {
-      // call depth only
-      hibernateOperationScope.callDepth.decrementAndGet();
+  public static void end(HibernateOperationScope scope, Throwable throwable) {
+    CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
+    if (callDepth.decrementAndGet() > 0) {
       return;
     }
 
-    int depth = hibernateOperationScope.callDepth.decrementAndGet();
-    if (depth != 0) {
-      throw new IllegalStateException("unexpected call depth " + depth);
+    if (scope != null) {
+      scope.end(throwable);
     }
-    hibernateOperationScope.scope.close();
-    instrumenter.end(
-        hibernateOperationScope.context,
-        hibernateOperationScope.hibernateOperation,
-        null,
-        throwable);
+  }
+
+  private void end(Throwable throwable) {
+    scope.close();
+    instrumenter.end(context, hibernateOperation, null, throwable);
   }
 }
diff --git a/instrumentation/hibernate/hibernate-procedure-call-4.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_3/ProcedureCallInstrumentation.java b/instrumentation/hibernate/hibernate-procedure-call-4.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_3/ProcedureCallInstrumentation.java
index 6c8a51dbdc..4574536735 100644
--- a/instrumentation/hibernate/hibernate-procedure-call-4.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_3/ProcedureCallInstrumentation.java
+++ b/instrumentation/hibernate/hibernate-procedure-call-4.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_3/ProcedureCallInstrumentation.java
@@ -13,7 +13,6 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
 
 import io.opentelemetry.context.Context;
 import io.opentelemetry.instrumentation.api.util.VirtualField;
-import io.opentelemetry.javaagent.bootstrap.CallDepth;
 import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
 import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@@ -51,9 +50,8 @@ public class ProcedureCallInstrumentation implements TypeInstrumentation {
     public static HibernateOperationScope startMethod(
         @Advice.This ProcedureCall call, @Advice.Origin("#m") String name) {
 
-      CallDepth callDepth = CallDepth.forClass(HibernateOperation.class);
-      if (callDepth.getAndIncrement() > 0) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+      if (HibernateOperationScope.isStarted()) {
+        return null;
       }
 
       VirtualField<ProcedureCall, SessionInfo> criteriaVirtualField =
@@ -64,18 +62,17 @@ public class ProcedureCallInstrumentation implements TypeInstrumentation {
       HibernateOperation hibernateOperation =
           new HibernateOperation("ProcedureCall." + name, call.getProcedureName(), sessionInfo);
       if (!instrumenter().shouldStart(parentContext, hibernateOperation)) {
-        return HibernateOperationScope.wrapCallDepth(callDepth);
+        return null;
       }
 
-      return HibernateOperationScope.startNew(
-          callDepth, hibernateOperation, parentContext, instrumenter());
+      return HibernateOperationScope.start(hibernateOperation, parentContext, instrumenter());
     }
 
     @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
     public static void endMethod(
-        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope enterScope) {
+        @Advice.Thrown Throwable throwable, @Advice.Enter HibernateOperationScope scope) {
 
-      HibernateOperationScope.end(enterScope, instrumenter(), throwable);
+      HibernateOperationScope.end(scope, throwable);
     }
   }
 }

@SylvainJuge
Copy link
Contributor Author

I think this is a good idea @laurit, I initially wanted to minimize the changes to "strictly necessary" for the migration, but it's even better if we can further simplify the enter advice by not directly using the call depth and passing it to the end advice. The only minor downside I see with this approach is that the state between enter and exit advices is not obvious (but we can make it clear in comments).

Given that CallDepth.forClass(HibernateOperation.class) does a lookup in a thread local storage there is little/no harm to do the lookup twice.

I will try to include your changes in this PR and update it.

@SylvainJuge
Copy link
Contributor Author

@laurit this works perfectly, I've only slightly renamed the nested call check method.

@trask trask merged commit 101d88f into open-telemetry:main Aug 22, 2024
56 checks passed
@SylvainJuge SylvainJuge deleted the indy-hibernate branch August 22, 2024 17:11
bhogayatakb pushed a commit to middleware-labs/opentelemetry-java-instrumentation that referenced this pull request Sep 13, 2024
* chore(deps): update gradle/actions action to v3.4.2 (main) (open-telemetry#11598)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Bump version in api diff compare (open-telemetry#11615)

* chore(deps): update graalvm/setup-graalvm action to v1.2.2 (main) (open-telemetry#11624)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Simplify jetty9 http client instrumentation (open-telemetry#11595)

* Merge change log updates from release/v1.33.x (open-telemetry#11628)

* fix(deps): update quarkus packages to v3.11.3 (main) (patch) (open-telemetry#11629)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* remove conditional indy test in CI (open-telemetry#11631)

* make aws-sdk indy compatible (open-telemetry#11552)

* fix(deps): update quarkus packages to v3.12.0 (main) (minor) (open-telemetry#11630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Remove aws sqs latest dep limit (open-telemetry#11643)

* Fix deprecation warning in build script (open-telemetry#11642)

* fix(deps): update dependency org.springframework.boot:spring-boot-starter-web to v3.3.1 (main) (open-telemetry#11644)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* re-use logic for http client configuration (open-telemetry#11620)

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* fix link (open-telemetry#11656)

* fix(deps): update dependency net.ltgt.gradle:gradle-errorprone-plugin to v4.0.1 (main) (open-telemetry#11652)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Influxdb client: don't fill db.statement for create/drop database and write operations (open-telemetry#11557)

* Update docs for bundled exporters (open-telemetry#11662)

* Improve test error report (open-telemetry#11664)

* Use more @ConditionalOnEnabledInstrumentation (open-telemetry#11665)

* Fix typo (open-telemetry#11672)

* Remove reflection from builder (open-telemetry#11673)

* fix(deps): update junit5 monorepo to v5.10.3 (main) (patch) (open-telemetry#11681)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* don't use test keystore for vaadin (open-telemetry#11679)

* Add address and port assertions (open-telemetry#11668)

* Update http metrics to the latest version (open-telemetry#11659)

* fix(deps): update armeria packages to v1.29.1 (main) (patch) (open-telemetry#11686)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency io.grpc:grpc-bom to v1.65.0 (main) (open-telemetry#11689)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix running ./gradlew tasks (open-telemetry#11692)

* chore(deps): update github/codeql-action action to v3.25.11 (main) (open-telemetry#11699)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update groovy monorepo (main) (patch) (open-telemetry#11706)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix build for graalvm native (open-telemetry#11709)

* add javalin instrumentation (open-telemetry#11587)

* fix(deps): update dependency io.opentelemetry.proto:opentelemetry-proto to v1.3.2-alpha (main) (open-telemetry#11715)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix kafka graalvm native (open-telemetry#11714)

* cleanup log filter (open-telemetry#11719)

* fix(deps): update dependency org.owasp:dependency-check-gradle to v10 (main) (open-telemetry#11720)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* config properties support for spring starter clients (open-telemetry#11605)

* fix(deps): update dependency org.owasp:dependency-check-gradle to v10.0.1 (main) (open-telemetry#11722)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* rebuild when labels change, so that we can trigger the right actions (open-telemetry#11725)

* Add GraalVM Kafka hints (open-telemetry#11735)

* Fix collector conf for overhead tests (open-telemetry#11730)

* fix(deps): update quarkus packages to v3.12.1 (main) (patch) (open-telemetry#11732)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Convert jsf jakarta tests from groovy to java (open-telemetry#11694)

* Fix GraalVM hint (open-telemetry#11737)

* Jsf: simplify asserting exception (open-telemetry#11736)

* Convert jsf javax tests from groovy to java (open-telemetry#11711)

* fix(deps): update dependency commons-logging:commons-logging to v1.3.3 (main) (open-telemetry#11740)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.codehaus.mojo:animal-sniffer-annotations to v1.24 (main) (open-telemetry#11741)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Replace junit4 @test annotation with junit5 annotation (open-telemetry#11745)

* chore(deps): update actions/upload-artifact action to v4.3.4 (main) (open-telemetry#11748)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update jackson packages to v2.17.2 (main) (patch) (open-telemetry#11750)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* fix(deps): update dependency org.owasp:dependency-check-gradle to v10.0.2 (main) (open-telemetry#11753)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Exclude javalin 3.2.0 from muzzle (open-telemetry#11766)

* Update the OpenTelemetry SDK version to 1.40.0 (open-telemetry#11752)

Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* support otel.instrumentation.common.default-enabled in spring starter (open-telemetry#11746)

* fix(deps): update dependency org.codenarc:codenarc to v3.5.0 (main) (open-telemetry#11758)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Add link to SDK configuration page (open-telemetry#11729)

* Build image for testing early jdk8 (open-telemetry#11594)

* fix(deps): update byte buddy packages to v1.14.18 (main) (patch) (open-telemetry#11767)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* Support tracing the ClickHouse Java HTTP client (open-telemetry#11660)

* support jettyclient 12 (open-telemetry#11519)

Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* Fix build (open-telemetry#11776)

* chore(deps): update gradle/actions action to v3.4.2 (main) (open-telemetry#11770)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Enable early jdk8 test (open-telemetry#11777)

* Add Pulsar MessagingProducerMetrics (open-telemetry#11591)

Co-authored-by: Lauri Tulmin <tulmin@gmail.com>
Co-authored-by: Steve Rao <raozihao.rzh@alibaba-inc.com>

* chore(deps): update actions/setup-node action to v4.0.3 (main) (open-telemetry#11780)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.assertj:assertj-core to v3.26.3 (main) (open-telemetry#11781)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix windows benchmark fail (open-telemetry#11698)

* Alter instrumentation suppression behavior (open-telemetry#11640)

* Propagate otel context through custom aws client context for lambda direct calls (open-telemetry#11675)

Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* fix(deps): update armeria packages to v1.29.2 (main) (patch) (open-telemetry#11785)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency io.quarkus:quarkus-bom to v3.12.2 (main) (open-telemetry#11787)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin io.quarkus to v3.12.2 (main) (open-telemetry#11789)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Spring autoconf deps (open-telemetry#11784)

* GraalVM native support for the OpenTelemetry annotations (open-telemetry#11757)

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* Use config properties for spring starter (http server) (open-telemetry#11667)

Co-authored-by: Lauri Tulmin <tulmin@gmail.com>
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* Update @EnableOpenTelemetry javadoc (open-telemetry#11799)

* chore(deps): update github/codeql-action action to v3.25.12 (main) (open-telemetry#11808)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency io.grpc:grpc-bom to v1.65.1 (main) (open-telemetry#11804)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dockerjavaversion to v3.4.0 (main) (minor) (open-telemetry#11802)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* rename spring autoconfigure to autoconfigure-2 (open-telemetry#11800)

* make spring starter stable (open-telemetry#11763)

* chore(deps): update dependency gradle to v8.9 (main) (open-telemetry#11798)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update ubuntu docker tag to v24 (main) (open-telemetry#11771)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix http.server.active_requests metric with async requests (open-telemetry#11638)

Co-authored-by: Helen <56097766+heyams@users.noreply.github.com>
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* Rename spring-boot-autoconfigure artifacts (open-telemetry#11815)

* fix(deps): update dependency org.owasp:dependency-check-gradle to v10.0.3 (main) (open-telemetry#11834)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency commons-codec:commons-codec to v1.17.1 (main) (open-telemetry#11830)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Remove unneeded groovy dependencies from lambda tests (open-telemetry#11828)

* Restructure to have a single spring-boot-autoconfigure artifact (open-telemetry#11826)

* chore(deps): update gradle/actions action to v3.5.0 (main) (open-telemetry#11824)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update change log for v2.6.0 release (open-telemetry#11816)

* Update version to 2.7.0-SNAPSHOT (open-telemetry#11839)

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* fix(deps): update testcontainers-java monorepo to v1.20.0 (main) (minor) (open-telemetry#11846)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update quarkus packages to v3.12.3 (main) (patch) (open-telemetry#11842)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Merge change log updates from release/v2.6.x (open-telemetry#11840)

* Update api diff after release (open-telemetry#11850)

* Add span baggage processor (open-telemetry#11697)

* Fix ClickHouse tracing when database name not included in connection string (open-telemetry#11852)

* fix(deps): update dependency io.netty:netty-bom to v4.1.112.final (main) (open-telemetry#11864)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update github/codeql-action action to v3.25.13 (main) (open-telemetry#11862)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.springframework.boot:spring-boot-starter-web to v3.3.2 (main) (open-telemetry#11855)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update errorproneversion to v2.29.2 (main) (minor) (open-telemetry#11836)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update bellsoft/liberica-openjdk-alpine docker tag to v21.0.4 (main) (open-telemetry#11863)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.apache.commons:commons-lang3 to v3.15.0 (main) (open-telemetry#11848)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency com.gradle.develocity:com.gradle.develocity.gradle.plugin to v3.17.6 (main) (open-telemetry#11875)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin com.gradle.develocity to v3.17.6 (main) (open-telemetry#11874)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update docker/login-action action to v3.3.0 (main) (open-telemetry#11877)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Consolidate github action renovate PRs (open-telemetry#11829)

* Reformat supported libraries doc (open-telemetry#11889)

* fix(deps): update quarkus packages to v3.13.0 (main) (minor) (open-telemetry#11894)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency com.google.protobuf:protobuf-java-util to v3.25.4 (main) (open-telemetry#11897)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix missing throw statement in RestClientWrapper (open-telemetry#11892) (open-telemetry#11893)

* Merge change log updates from release/v1.33.x (open-telemetry#11904)

* fix(deps): update armeria packages to v1.29.3 (main) (patch) (open-telemetry#11906)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update github actions (main) (open-telemetry#11910)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency com.uber.nullaway:nullaway to v0.11.1 (main) (open-telemetry#11916)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update armeria packages to v1.29.4 (main) (patch) (open-telemetry#11923)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix latest dep tests (open-telemetry#11925)

* Convert jsp 2.3 tests from groovy to java (open-telemetry#11827)

* fix(deps): update testcontainers-java monorepo to v1.20.1 (main) (patch) (open-telemetry#11931)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix broken link (open-telemetry#11935)

* Allow any types in invokedynamic advice method signatures (open-telemetry#11873)

Co-authored-by: Lauri Tulmin <tulmin@gmail.com>

* Improve tomcat version detection (open-telemetry#11936)

* Add @jaydeluca as triager (open-telemetry#11937)

* Update kafka docker image (open-telemetry#11938)

* chore(deps): update actions/upload-artifact action to v4.3.5 (main) (open-telemetry#11943)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix class cast exception, noop meter does not implement incubating api (open-telemetry#11934)

* Executors indy support (open-telemetry#11738)

* idempotent license report (open-telemetry#11810)

Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* chore(deps): update plugin org.jetbrains.kotlin.jvm to v2.0.10 (main) (open-telemetry#11955)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update slf4j monorepo to v2.0.14 (main) (patch) (open-telemetry#11957)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* fix(deps): update dependency org.awaitility:awaitility to v4.2.2 (main) (open-telemetry#11960)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency io.quarkus:quarkus-bom to v3.13.1 (main) (open-telemetry#11962)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin io.quarkus to v3.13.1 (main) (open-telemetry#11966)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.apache.commons:commons-lang3 to v3.16.0 (main) (open-telemetry#11967)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency io.grpc:grpc-bom to v1.66.0 (main) (open-telemetry#11972)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update slf4j monorepo to v2.0.15 (main) (patch) (open-telemetry#11976)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* Update shadow plugin to new version and coordinates (open-telemetry#11979)

* Improve akka route handling with java dsl (open-telemetry#11926)

* fix(deps): update dependency org.slf4j:slf4j-simple to v2.0.15 (main) (open-telemetry#11981)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Ignore alibaba fastjson ASMClassLoader (open-telemetry#11954)

* fix(deps): update quarkus packages to v3.13.2 (main) (patch) (open-telemetry#11983)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Convert cdi-testing test from groovy to java (open-telemetry#11982)

* fix(deps): update slf4j monorepo to v2.0.16 (main) (patch) (open-telemetry#11989)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* chore(deps): update github actions (main) (open-telemetry#11995)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update gradle/actions action to v4 (main) (open-telemetry#11996)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update errorproneversion to v2.30.0 (main) (minor) (open-telemetry#11991)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* Use `aws-lambda-java-serialization` library, which is available by default, while deserializing input and serializing output (open-telemetry#11868)

* fix(deps): update armeria packages to v1.30.0 (main) (minor) (open-telemetry#12001)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Influxdb indy support (open-telemetry#11710)

Co-authored-by: Jonas Kunz <jonas.kunz@elastic.co>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* Force dynamic typing on AssignReturned annotations (open-telemetry#11884)

* Update the OpenTelemetry SDK version to 1.41.0 (open-telemetry#11985)

Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* Fix building wildfly docker image (open-telemetry#11998)

* Add assert inverse to ktor2 muzzle configuration (open-telemetry#11948)

* chore(deps): update dependency gradle to v8.10 (main) (open-telemetry#12014)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Closing a kafka producer/consumer should not disable metrics from other consumers/producers (open-telemetry#11975)

* Logback appender: map timestamp in nanoseconds if possible (open-telemetry#11807) (open-telemetry#11974)

* Save ILoggingEvent.getArgumentArray() arguments from Logback  (open-telemetry#11865)

Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* use DefaultHttpClientInstrumenterBuilder and DefaultHttpServerInstrumenterBuilder for armeria (open-telemetry#11797)

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* Fix ending span in Ktor plugin (open-telemetry#11726)

* Use stable semconv for Java17 (open-telemetry#11914)

Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* fix(deps): update dependency commons-cli:commons-cli to v1.9.0 (main) (open-telemetry#12017)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Limit vaadin 14 latest dep version (open-telemetry#12025)

* Add Pulsar Consumer metrics (open-telemetry#11891)

Co-authored-by: Lauri Tulmin <tulmin@gmail.com>
Co-authored-by: Steve Rao <raozihao.rzh@alibaba-inc.com>

* Fix logback appender test (open-telemetry#12027)

* fix(deps): update junit5 monorepo to v5.11.0 (main) (minor) (open-telemetry#12010)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* fix(deps): update dependency ch.qos.logback:logback-classic to v1.5.7 (main) (open-telemetry#12029)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin com.github.jk1.dependency-license-report to v2.9 (main) (open-telemetry#12030)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix netty memory leak (open-telemetry#12003)

* Update change log (open-telemetry#12019)

* fix(deps): update byte buddy packages to v1.14.19 (main) (patch) (open-telemetry#12033)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* Update version to 2.8.0-SNAPSHOT (open-telemetry#12037)

Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* Update api diffs (open-telemetry#12045)

* chore(deps): update github/codeql-action action to v3.26.2 (main) (open-telemetry#12047)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update guava packages to v33.3.0-jre (main) (minor) (open-telemetry#12040)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency com.gradle.develocity:com.gradle.develocity.gradle.plugin to v3.18 (main) (open-telemetry#12051)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin com.gradle.develocity to v3.18 (main) (open-telemetry#12050)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency commons-logging:commons-logging to v1.3.4 (main) (open-telemetry#12053)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency com.uber.nullaway:nullaway to v0.11.2 (main) (open-telemetry#12057)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Try to fix disabling renovate updates for spring boot (open-telemetry#12059)

* [improve][pulsar] Enhance SendCallback to address PIP-363 (open-telemetry#11648)

Co-authored-by: Lauri Tulmin <tulmin@gmail.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* Delay loading `InetAddressResolverProvider` until after the agent has started (open-telemetry#11987)

Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* Remove unused renovate config (open-telemetry#12060)

* fix(deps): update quarkus packages to v3.13.3 (main) (patch) (open-telemetry#12067)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update otelcontribversion to v1.38.0-alpha (main) (minor) (open-telemetry#12061)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* Fix instrumentation for the latest version of ucp (open-telemetry#12052)

* JdbcIgnoredTypesConfigurer support Shardingsphere 5.x (open-telemetry#12066)

* fix(deps): update quarkus packages to v3.14.0 (main) (minor) (open-telemetry#12074)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* enforce static imports (open-telemetry#12009)

* chore(deps): update plugin org.jetbrains.kotlin.jvm to v2.0.20 (main) (open-telemetry#12081)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* make netty-* indy compatible (open-telemetry#11559)

Co-authored-by: Jonas Kunz <jonas.kunz@elastic.co>
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* make hibernate-* indy compatible (open-telemetry#11553)

* fix(deps): update dependency org.springframework.boot:spring-boot-starter-web to v3.3.3 (main) (open-telemetry#12087)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update github/codeql-action action to v3.26.5 (main) (open-telemetry#12105)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency checkstyle to v10.18.0 (main) (open-telemetry#12103)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Add workflow to complete 1.33.6 to main (open-telemetry#12107)

* fix(deps): update byte buddy packages to v1.15.0 (main) (minor) (open-telemetry#12094)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* Fix rabbitmq NullPointerException (open-telemetry#12109)

* Merge change log updates from release/v1.33.x (open-telemetry#12114)

* Remove temporary workflow (open-telemetry#12115)

* Name is not needed for annotation value parameter (open-telemetry#12113)

* Convert apache-httpclient-2.0 tests from groovy to java (open-telemetry#12102)

Co-authored-by: Steve Rao <raozihao.rzh@alibaba-inc.com>

* convert spring integration tests to java (open-telemetry#11999)

Co-authored-by: Jay DeLuca <jaydeluca4@gmail.com>

* Add network peer address attributes to the span for the `okhttp-3.0` instrumentation (open-telemetry#12012)

* Add support for cxf 4.0 jaxws (open-telemetry#12077)

* fix(deps): update dependency org.mockito:mockito-core to v5.13.0 (main) (open-telemetry#12123)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update quarkus packages to v3.14.1 (main) (patch) (open-telemetry#12129)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* indy advice docs & migration procedure (open-telemetry#11546)

* fix(deps): update errorproneversion to v2.31.0 (main) (minor) (open-telemetry#12134)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update units of time based metrics from millis to seconds for Java17 … (open-telemetry#12084)

* Added rules for capturing  Apache Camel metrics exposed by JMX MBeans (open-telemetry#11901)

* Fix play-mvc\methods NullPointerException (open-telemetry#12121)

* Spring batch tests to java - basic (open-telemetry#12076)

* chore(deps): update plugin com.gradle.plugin-publish to v1.2.2 (main) (open-telemetry#12137)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Pin github actions by hash (open-telemetry#12140)

* fix(deps): update dependency org.apache.commons:commons-lang3 to v3.17.0 (main) (open-telemetry#12145)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency checkstyle to v10.18.1 (main) (open-telemetry#12150)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update byte buddy packages to v1.15.1 (main) (patch) (open-telemetry#12141)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>

* fix(deps): update dependency org.owasp:dependency-check-gradle to v10.0.4 (main) (open-telemetry#12152)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update github actions (main) (open-telemetry#12155)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix error span status for successful requests in Ktor (open-telemetry#12161)

* Convert opentelemetry-api-1.0 tests from groovy to java (open-telemetry#12133)

Co-authored-by: Lauri Tulmin <tulmin@gmail.com>

* convert module apache-dubbo-2.7 test case from groovy to java (open-telemetry#12008)

Co-authored-by: Jay DeLuca <jaydeluca4@gmail.com>

* Test whether http client span ends after headers or body is received (open-telemetry#12149)

* Remove unused imports (open-telemetry#12165)

* Keep junit extensions in static fields (open-telemetry#12166)

* fix(deps): update dependency io.netty:netty-bom to v4.1.113.final (main) (open-telemetry#12169)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update quarkus packages to v3.14.2 (main) (patch) (open-telemetry#12167)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* make internal-reflection indy compatible (open-telemetry#12136)

Co-authored-by: Jonas Kunz <jonas.kunz@elastic.co>

* Make OpenTelemetry-API Bridge and dependent instrumentations work with indy (open-telemetry#11578)

* Make log record asserts similar to trace asserts (open-telemetry#12164)

* Enable tests for jedis 2.7.2 (open-telemetry#12175)

* Add empty line to separate blocks (open-telemetry#12174)

* Fix flaky spring integration test (open-telemetry#12185)

* Read timeout in jetty http client tests (open-telemetry#12184)

* Make rocketmq span status extractor delegate to default extractor (open-telemetry#12183)

* Remove unneeded span status extractor (open-telemetry#12182)

* fix(deps): update dependency org.apache.logging.log4j:log4j-bom to v2.24.0 (main) (open-telemetry#12187)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency ch.qos.logback:logback-classic to v1.5.8 (main) (open-telemetry#12189)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency gradle to v8.10.1 (main) (open-telemetry#12191)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin org.graalvm.buildtools.native to v0.10.3 (main) (open-telemetry#12205)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin com.gradleup.shadow to v8.3.1 (main) (open-telemetry#12208)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency com.gradleup.shadow:shadow-gradle-plugin to v8.3.1 (main) (open-telemetry#12209)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin com.gradle.develocity to v3.18.1 (main) (open-telemetry#12211)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency com.gradle.develocity:com.gradle.develocity.gradle.plugin to v3.18.1 (main) (open-telemetry#12212)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* updating .gitignore to ignore workflows except the middleware one

* test fix, and reverted to grpc as default otel protocol

* Added feature flag for continuous profiling

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
Co-authored-by: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com>
Co-authored-by: SylvainJuge <763082+SylvainJuge@users.noreply.github.com>
Co-authored-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Co-authored-by: Jay DeLuca <jaydeluca4@gmail.com>
Co-authored-by: Jean Bisutti <jean.bisutti@gmail.com>
Co-authored-by: crossoverJie <crossoverJie@gmail.com>
Co-authored-by: Lucas Amoroso <amorosolucas@gmail.com>
Co-authored-by: Liu Ziming <liuziming.lzm@alibaba-inc.com>
Co-authored-by: Lauri Tulmin <tulmin@gmail.com>
Co-authored-by: Steve Rao <raozihao.rzh@alibaba-inc.com>
Co-authored-by: John Bley <jbley@splunk.com>
Co-authored-by: Helen <56097766+heyams@users.noreply.github.com>
Co-authored-by: kyy1996 <system@kyy1996.com>
Co-authored-by: Jonas Kunz <jonas.kunz@elastic.co>
Co-authored-by: César <56847527+LikeTheSalad@users.noreply.github.com>
Co-authored-by: jason plumb <75337021+breedx-splk@users.noreply.github.com>
Co-authored-by: Serkan ÖZAL <sozal@catchpoint.com>
Co-authored-by: Jérôme Joslet <jerome.joslet@gmail.com>
Co-authored-by: Igor Suhorukov <igor.suhorukov@gmail.com>
Co-authored-by: Mariia Skripchenko <61115099+marychatte@users.noreply.github.com>
Co-authored-by: Robert Niedziela <175605712+robsunday@users.noreply.github.com>
Co-authored-by: 道君 <daojun@apache.org>
Co-authored-by: Shelby Huang <48885776+huange7@users.noreply.github.com>
Co-authored-by: xiepuhuan <puhuanxie@gmail.com>
Co-authored-by: Luigi De Masi <5583341+luigidemasi@users.noreply.github.com>
Co-authored-by: shalk(xiao kun) <xshalk@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants