dmsolr commented on issue #6915:
URL: https://github.com/apache/skywalking/issues/6915#issuecomment-836146677


   I'd like to talk about this deeply.
   IMO, to extend `ClassEnhancePluginDefine` API on the user end. We add the 
following two methods.
   ```java
   public abstract class AbstractClassEnhancePluginDefine {
     /**
      * Instance methods intercept point v2. See {@link 
InstanceMethodsInterceptPointV2}
      *
      * @return collections of {@link InstanceMethodsInterceptPointV2}
      */
     public abstract InstanceMethodsInterceptPointV2[] 
getInstanceMethodsInterceptPointV2s();
     
     /**
      * Instance methods intercept point v2. See {@link 
InstanceMethodsInterceptPointV2}
      *
      * @return collections of {@link InstanceMethodsInterceptPointV2}
      */
     public abstract StaticMethodsInterceptPointV2[] 
getStaticMethodsInterceptPointV2s();
   }
   ```
   In other words, users can impleme interceptor  v1 and v2 APIs in the same 
class. 
   
   And then, we need to add a new method, named "enhanceV2(...)", to get all 
intercepting points from user-defined and to achieve target method 
instrumentation. 
   ```java
   protected DynamicType.Builder<?> enhanceV2(TypeDescription typeDescription, 
DynamicType.Builder<?> newClassBuilder,
                                             ClassLoader classLoader, 
EnhanceContext context) throws PluginException {
     newClassBuilder = this.enhanceClassV2(typeDescription, newClassBuilder, 
classLoader);
     newClassBuilder = this.enhanceInstanceV2(typeDescription, newClassBuilder, 
classLoader, context);
     return newClassBuilder;
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to