You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/09/27 01:42:53 UTC

[GitHub] [skywalking-java] VictorZeng opened a new pull request #39: Add an agent plugin to support Jackson

VictorZeng opened a new pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39


   <!--
       ⚠️ Please make sure to read this template first, pull requests that don't accord with this template
       maybe closed without notice.
       Texts surrounded by `<` and `>` are meant to be replaced by you, e.g. <framework name>, <issue number>.
       Put an `x` in the `[ ]` to mark the item as CHECKED. `[x]`
   -->
   
   <!-- ==== 🐛 Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist 👇 ====
   ### Fix <bug description or the bug issue number or bug issue link>
   - [ ] Add a unit test to verify that the fix works.
   - [ ] Explain briefly why the bug exists and how to fix it.
        ==== 🐛 Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist 👆 ==== -->
   
   <!-- ==== 🔌 Remove this line WHEN AND ONLY WHEN you're adding a new plugin, follow the checklist 👇 ====
        ==== 🔌 Remove this line WHEN AND ONLY WHEN you're adding a new plugin, follow the checklist 👆 ==== -->
   
   ### Add an agent plugin to support `Jackson`
   - [x] Add a test case for the new plugin, refer to [the doc](https://github.com/apache/skywalking-java/blob/main/docs/en/setup/service-agent/java-agent/Plugin-test.md)
   - [x] Add a component id in [the component-libraries.yml](https://github.com/apache/skywalking/blob/master/oap-server/server-starter/src/main/resources/component-libraries.yml)
   - [ ] Add a logo in [the UI repo](https://github.com/apache/skywalking-rocketbot-ui/tree/master/src/views/components/topology/assets)
   
   <!-- ==== 📈 Remove this line WHEN AND ONLY WHEN you're improving the performance, follow the checklist 👇 ====
   ### Improve the performance of <class or module or ...>
   - [ ] Add a benchmark for the improvement, refer to [the existing ones](https://github.com/apache/skywalking-java/blob/main/apm-commons/apm-datacarrier/src/test/java/org/apache/skywalking/apm/commons/datacarrier/LinkedArrayBenchmark.java)
   - [ ] The benchmark result.
   ```text
   <Paste the benchmark results here>
   ```
   - [ ] Links/URLs to the theory proof or discussion articles/blogs. <links/URLs here>
        ==== 📈 Remove this line WHEN AND ONLY WHEN you're improving the performance, follow the checklist 👆 ==== -->
   
   <!-- ==== 🆕 Remove this line WHEN AND ONLY WHEN you're adding a new feature, follow the checklist 👇 ====
   ### <Feature description>
   - [ ] If this is non-trivial feature, paste the links/URLs to the design doc.
   - [ ] Update the documentation to include this new feature.
   - [ ] Tests(including UT, IT, E2E) are added to verify the new feature.
   - [ ] If it's UI related, attach the screenshots below.
        ==== 🆕 Remove this line WHEN AND ONLY WHEN you're adding a new feature, follow the checklist 👆 ==== -->
   
   - [x] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes https://github.com/apache/skywalking/issues/7812.
   - [x] Update the [`CHANGES` log](https://github.com/apache/skywalking-java/blob/main/CHANGES.md).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927625757


   > > @wu-sheng @kezhenxu94 How about init `ENHANCE_METHODS ` in static method block?
   > 
   > Okay to me
   
   Thank u. 


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] wu-sheng commented on a change in pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#discussion_r716327178



##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jackson/define/AbstractInstrumentation.java
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jackson.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+/**
+ * Jackson has been known as "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".

Review comment:
       Removing this whole sentence and keeping the later one should be enough.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927682836


   > Thank you @VictorZeng . One nit: it seems that you didn't import our code style settings, the new files still don't respect to the code styles, please consider import our code style settings if you are going to contribute later
   
   Thank you for review, I will import the checkstyle.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng edited a comment on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng edited a comment on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927542454






-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] wu-sheng merged pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
wu-sheng merged pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39


   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on a change in pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on a change in pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#discussion_r716328918



##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jackson/define/AbstractInstrumentation.java
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jackson.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+/**
+ * Jackson has been known as "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".

Review comment:
       OK, I will remove it.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927624077


   @wu-sheng @kezhenxu94 How about init `ENHANCE_METHODS ` in static method block?


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] wu-sheng commented on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927571916






-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on a change in pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on a change in pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#discussion_r716333120



##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jackson/BasicMethodsInterceptor.java
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jackson;
+
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+
+import java.lang.reflect.Method;
+
+public class BasicMethodsInterceptor implements InstanceMethodsAroundInterceptor {

Review comment:
       OK, I will format it.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927515473


   @kezhenxu94 use the guava `ImmutableMap` is a good idea, but failed the checkstyle.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on a change in pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on a change in pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#discussion_r716332508



##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/pom.xml
##########
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.skywalking</groupId>
+        <artifactId>optional-plugins</artifactId>
+        <version>8.8.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>apm-jackson-2.x-plugin</artifactId>
+    <name>jackson-2.x-plugin</name>
+    <packaging>jar</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <jackson.version>2.9.9</jackson.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+            <version>${jackson.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>

Review comment:
       OK, I will remove it.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] kezhenxu94 commented on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927624748


   > @wu-sheng @kezhenxu94 How about init `ENHANCE_METHODS ` in static method block?
   
   Okay to me


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on a change in pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on a change in pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#discussion_r716334921



##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jackson/define/AbstractInstrumentation.java
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jackson.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+/**
+ * Jackson has been known as "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
+ * <p>
+ * Jackson provides a "one stop" solution for json serialization and deserialization solution basic requirements.
+ */
+
+public abstract class AbstractInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+
+    @Override
+    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+        return new ConstructorInterceptPoint[0];
+    }
+
+    @Override
+    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+
+        final List<InstanceMethodsInterceptPoint> points = new ArrayList<InstanceMethodsInterceptPoint>(this.enhanceMethods().size());
+
+        for (Map.Entry<String, String> entry : this.enhanceMethods().entrySet()) {
+            final InstanceMethodsInterceptPoint point = new InstanceMethodsInterceptPoint() {
+                @Override
+                public ElementMatcher<MethodDescription> getMethodsMatcher() {
+                    return named(entry.getKey());
+                }
+
+                @Override
+                public String getMethodsInterceptor() {
+                    return entry.getValue();
+                }
+
+                @Override
+                public boolean isOverrideArgs() {
+                    return false;
+                }
+            };
+            points.add(point);
+        }
+
+        return points.toArray(new InstanceMethodsInterceptPoint[points.size()]);

Review comment:
       I remember the `List.toArray(T[] a)`  recommended to give the array size. Because it won't recreate an array.
   
   ```java
       public <T> T[] toArray(T[] a) {
           if (a.length < size)
               // Make a new array of a's runtime type, but my contents:
               return (T[]) Arrays.copyOf(elementData, size, a.getClass());
           System.arraycopy(elementData, 0, a, 0, size);
           if (a.length > size)
               a[size] = null;
           return a;
       }
   ```




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] kezhenxu94 commented on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927516975


   > @kezhenxu94 use the guava `ImmutableMap` is a good idea, but failed the checkstyle.
   
   ok. We need some adjustments of the check style settings


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927537198






-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on a change in pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on a change in pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#discussion_r716338304



##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jackson/define/AbstractInstrumentation.java
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jackson.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+/**
+ * Jackson has been known as "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
+ * <p>
+ * Jackson provides a "one stop" solution for json serialization and deserialization solution basic requirements.
+ */
+
+public abstract class AbstractInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+
+    @Override
+    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+        return new ConstructorInterceptPoint[0];
+    }
+
+    @Override
+    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+
+        final List<InstanceMethodsInterceptPoint> points = new ArrayList<InstanceMethodsInterceptPoint>(this.enhanceMethods().size());
+
+        for (Map.Entry<String, String> entry : this.enhanceMethods().entrySet()) {
+            final InstanceMethodsInterceptPoint point = new InstanceMethodsInterceptPoint() {
+                @Override
+                public ElementMatcher<MethodDescription> getMethodsMatcher() {
+                    return named(entry.getKey());
+                }
+
+                @Override
+                public String getMethodsInterceptor() {
+                    return entry.getValue();
+                }
+
+                @Override
+                public boolean isOverrideArgs() {
+                    return false;
+                }
+            };
+            points.add(point);
+        }
+
+        return points.toArray(new InstanceMethodsInterceptPoint[points.size()]);

Review comment:
        Since openJDK 6, recommended use the null array for this method. I will fix it.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] kezhenxu94 commented on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927537928






-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927662319


   @kezhenxu94 `elasticjob-3.x-scenario` health check failed, it runs successfully on my local.
   ```
   + status=0
   + [[ 0 == 0 ]]
   + [[ -z '' ]]
   + rm -rf /home/skywalking-java/test/plugin/workspace/elasticjob-3.x-scenario/3.0.0
   + num_of_testcases=1
   + echo -e '\033[33melasticjob-3.x-scenario has already sumbitted\033[0m'
   elasticjob-3.x-scenario has already sumbitted
   + exitAndClean 0
   ++ date +%s
   + elapsed=404
   + [[ 0 -eq 1 ]]
   + printf 'Scenarios: elasticjob-3.x-scenario, Testcases: 1, Elapsed: %02d:%02d:%02d \n' 0 6 44
   Scenarios: elasticjob-3.x-scenario, Testcases: 1, Elapsed: 00:06:44 
   + exit 0
   ```


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] wu-sheng commented on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927503766


   > Apart from the comments inline, I'd also like to discuss whether we should also include part of the JSON string / bytes in the trace, for example, collect the first 64 bytes as a tag `content` and the `64` is configurable.
   > 
   > Currently we only have the time cost in (de)serializing and the length of the content, but it makes little sense that we don't know what the content is when the time cost is too long, including part of the content might give the users some hints what content makes the JSON lib slower.
   
   Agree, collecting content is a risk. I prefer we don't do this.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on a change in pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on a change in pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#discussion_r716331656



##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jackson/define/ObjectMapperInstrumentation.java
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jackson.define;
+
+import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
+import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Jackson has been known as "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".

Review comment:
       OK, I will remove it.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] VictorZeng commented on pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
VictorZeng commented on pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#issuecomment-927505134


   > > Apart from the comments inline, I'd also like to discuss whether we should also include part of the JSON string / bytes in the trace, for example, collect the first 64 bytes as a tag `content` and the `64` is configurable.
   > > Currently we only have the time cost in (de)serializing and the length of the content, but it makes little sense that we don't know what the content is when the time cost is too long, including part of the content might give the users some hints what content makes the JSON lib slower.
   > 
   > Agree, collecting content is a risk. I prefer we don't do this.
   
   I think that providing JSON length can satisfy most user scenarios. It is not recommended to collect JSON content.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-java] kezhenxu94 commented on a change in pull request #39: Add an agent plugin to support Jackson

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #39:
URL: https://github.com/apache/skywalking-java/pull/39#discussion_r716321760



##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jackson/define/ObjectMapperInstrumentation.java
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jackson.define;
+
+import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
+import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Jackson has been known as "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
+ * <p>
+ * Jackson provides a "one stop" solution for json serialization and deserialization solution basic requirements.
+ * <p>
+ * ObjectMapper: writeValue()\writeValueAsString()\writeValueAsBytes()\readValue()
+ */
+
+public class ObjectMapperInstrumentation extends AbstractInstrumentation {
+
+    @Override
+    protected ClassMatch enhanceClass() {
+        return NameMatch.byName("com.fasterxml.jackson.databind.ObjectMapper");
+    }
+
+    @Override
+    protected Map<String, String> enhanceMethods() {
+        return new HashMap<String, String>() {
+            {
+                put("writeValue", "org.apache.skywalking.apm.plugin.jackson.BasicMethodsInterceptor");
+                put("writeValueAsString", "org.apache.skywalking.apm.plugin.jackson.WriteValueAsStringInterceptor");
+                put("writeValueAsBytes", "org.apache.skywalking.apm.plugin.jackson.WriteValueAsBytesInterceptor");
+                put("readValue", "org.apache.skywalking.apm.plugin.jackson.ReadValueInterceptor");
+            }
+        };

Review comment:
       Consider using a builder to build the map instead of creating anonymous inner classes, which creates unnecessary class.
   
   ```suggestion
           return ImmutableMap.<String, String>builder()
                              .put(
                                  "writeValue",
                                  "org.apache.skywalking.apm.plugin.jackson.BasicMethodsInterceptor"
                              )
                              .put(
                                  "writeValueAsString",
                                  "org.apache.skywalking.apm.plugin.jackson.WriteValueAsStringInterceptor"
                              )
                              .put(
                                  "writeValueAsBytes",
                                  "org.apache.skywalking.apm.plugin.jackson.WriteValueAsBytesInterceptor"
                              )
                              .put(
                                  "readValue",
                                  "org.apache.skywalking.apm.plugin.jackson.ReadValueInterceptor"
                              )
                              .build();
   ```

##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jackson/define/ObjectMapperInstrumentation.java
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jackson.define;
+
+import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
+import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Jackson has been known as "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".

Review comment:
       Same here

##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/pom.xml
##########
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.skywalking</groupId>
+        <artifactId>optional-plugins</artifactId>
+        <version>8.8.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>apm-jackson-2.x-plugin</artifactId>
+    <name>jackson-2.x-plugin</name>
+    <packaging>jar</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <jackson.version>2.9.9</jackson.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+            <version>${jackson.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>

Review comment:
       Is this needed? Seems it's unused

##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jackson/define/AbstractInstrumentation.java
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jackson.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+/**
+ * Jackson has been known as "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
+ * <p>
+ * Jackson provides a "one stop" solution for json serialization and deserialization solution basic requirements.
+ */
+
+public abstract class AbstractInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+
+    @Override
+    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+        return new ConstructorInterceptPoint[0];
+    }
+
+    @Override
+    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+
+        final List<InstanceMethodsInterceptPoint> points = new ArrayList<InstanceMethodsInterceptPoint>(this.enhanceMethods().size());

Review comment:
       ```suggestion
           final List<InstanceMethodsInterceptPoint> points = new ArrayList<>(this.enhanceMethods().size());
   ```

##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jackson/define/AbstractInstrumentation.java
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jackson.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+/**
+ * Jackson has been known as "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".

Review comment:
       Hi @VictorZeng , can you remove the words `the best` and avoid using similar words in the future? I don't mean they are wrong or Jackson is not good enough, but in Apache projects, we should not endorse for any third-parties / vendors.

##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jackson/BasicMethodsInterceptor.java
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jackson;
+
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+
+import java.lang.reflect.Method;
+
+public class BasicMethodsInterceptor implements InstanceMethodsAroundInterceptor {

Review comment:
       Import our code style settings and format this file, it has some lines that are too long

##########
File path: apm-sniffer/optional-plugins/jackson-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jackson/define/AbstractInstrumentation.java
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jackson.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+/**
+ * Jackson has been known as "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
+ * <p>
+ * Jackson provides a "one stop" solution for json serialization and deserialization solution basic requirements.
+ */
+
+public abstract class AbstractInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+
+    @Override
+    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+        return new ConstructorInterceptPoint[0];
+    }
+
+    @Override
+    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+
+        final List<InstanceMethodsInterceptPoint> points = new ArrayList<InstanceMethodsInterceptPoint>(this.enhanceMethods().size());
+
+        for (Map.Entry<String, String> entry : this.enhanceMethods().entrySet()) {
+            final InstanceMethodsInterceptPoint point = new InstanceMethodsInterceptPoint() {
+                @Override
+                public ElementMatcher<MethodDescription> getMethodsMatcher() {
+                    return named(entry.getKey());
+                }
+
+                @Override
+                public String getMethodsInterceptor() {
+                    return entry.getValue();
+                }
+
+                @Override
+                public boolean isOverrideArgs() {
+                    return false;
+                }
+            };
+            points.add(point);
+        }
+
+        return points.toArray(new InstanceMethodsInterceptPoint[points.size()]);

Review comment:
       This is recommended, I remember the Fastjson did the same thing, can you update that too?
   
   ```suggestion
           return points.toArray(new InstanceMethodsInterceptPoint[0]);
   ```




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org