2323import io .opentelemetry .javaagent .extension .instrumentation .TypeTransformer ;
2424import java .util .Map ;
2525import net .bytebuddy .asm .Advice ;
26+ import net .bytebuddy .description .enumeration .EnumerationDescription ;
2627import net .bytebuddy .description .type .TypeDescription ;
2728import net .bytebuddy .implementation .bytecode .assign .Assigner ;
2829import net .bytebuddy .matcher .ElementMatcher ;
29- import net .bytebuddy .utility .JavaConstant ;
3030
3131@ SuppressWarnings ("EnumOrdinal" )
3232public class MethodInstrumentation implements TypeInstrumentation {
@@ -71,8 +71,8 @@ public void transform(TypeTransformer transformer) {
7171 SpanKindOrdinal .class ,
7272 (instrumentedType , instrumentedMethod , assigner , argumentHandler , sort ) ->
7373 Advice .OffsetMapping .Target .ForStackManipulation .of (
74- JavaConstant . Simple . ofLoaded (
75- methodNames .get (instrumentedMethod .getName ()). ordinal () ))),
74+ new EnumerationDescription . ForLoadedEnumeration (
75+ methodNames .get (instrumentedMethod .getName ())))),
7676 MethodInstrumentation .class .getName () + "$MethodAdvice" );
7777 }
7878
@@ -87,7 +87,7 @@ public static class MethodAdvice {
8787
8888 @ Advice .OnMethodEnter (suppress = Throwable .class )
8989 public static void onEnter (
90- @ SpanKindOrdinal int spanKindOrdinal ,
90+ @ SpanKindOrdinal SpanKind spanKind ,
9191 @ Advice .Origin ("#t" ) Class <?> declaringClass ,
9292 @ Advice .Origin ("#m" ) String methodName ,
9393 @ Advice .Local ("otelMethod" ) MethodAndType classAndMethod ,
@@ -97,7 +97,7 @@ public static void onEnter(
9797 classAndMethod =
9898 MethodAndType .create (
9999 ClassAndMethod .create (declaringClass , methodName ),
100- SpanKind . values ()[ spanKindOrdinal ] );
100+ spanKind );
101101
102102 if (!instrumenter ().shouldStart (parentContext , classAndMethod )) {
103103 return ;
0 commit comments