2424import org .apache .skywalking .apm .agent .core .plugin .interceptor .InstanceMethodsInterceptPoint ;
2525import org .apache .skywalking .apm .agent .core .plugin .interceptor .enhance .ClassInstanceMethodsEnhancePluginDefine ;
2626import org .apache .skywalking .apm .agent .core .plugin .match .ClassMatch ;
27+ import org .apache .skywalking .apm .agent .core .plugin .match .MultiClassNameMatch ;
2728
2829import static net .bytebuddy .matcher .ElementMatchers .named ;
2930import static net .bytebuddy .matcher .ElementMatchers .takesNoArguments ;
30- import static org .apache .skywalking .apm .agent .core .plugin .match .NameMatch .byName ;
3131
3232public class AbstractServerImplBuilderInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
3333
34- public static final String ENHANCE_CLASS = "io.grpc.internal.AbstractServerImplBuilder" ;
35- public static final String ENHANCE_METHOD = "build" ;
36- public static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.grpc.v1.server.AbstractServerImplBuilderInterceptor" ;
37-
3834 @ Override
3935 public ConstructorInterceptPoint [] getConstructorsInterceptPoints () {
4036 return new ConstructorInterceptPoint [0 ];
@@ -46,12 +42,12 @@ public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
4642 new InstanceMethodsInterceptPoint () {
4743 @ Override
4844 public ElementMatcher <MethodDescription > getMethodsMatcher () {
49- return named (ENHANCE_METHOD ).and (takesNoArguments ());
45+ return named ("build" ).and (takesNoArguments ());
5046 }
5147
5248 @ Override
5349 public String getMethodsInterceptor () {
54- return INTERCEPT_CLASS ;
50+ return "org.apache.skywalking.apm.plugin.grpc.v1.server.AbstractServerImplBuilderInterceptor" ;
5551 }
5652
5753 @ Override
@@ -64,6 +60,9 @@ public boolean isOverrideArgs() {
6460
6561 @ Override
6662 protected ClassMatch enhanceClass () {
67- return byName (ENHANCE_CLASS );
63+ return MultiClassNameMatch .byMultiClassMatch (
64+ "io.grpc.internal.AbstractServerImplBuilder" ,
65+ "io.grpc.internal.ServerImplBuilder" ,
66+ "io.grpc.internal.ForwardingServerBuilder" );
6867 }
6968}
0 commit comments