From 65456716a3fbfabb2e78814f21a531c69b66e141 Mon Sep 17 00:00:00 2001 From: ascrutae Date: Sun, 25 Feb 2018 21:43:27 +0800 Subject: [PATCH] add comment --- .../apm/plugin/hystrix/v1/EnhanceRequireObjectCache.java | 6 ++++++ .../hystrix/v1/HystrixCommandConstructorInterceptor.java | 7 +++++++ .../apm/plugin/hystrix/v1/HystrixPluginsInterceptor.java | 8 +++++++- .../apm/plugin/hystrix/v1/SWExecutionHookWrapper.java | 5 +++++ .../hystrix/v1/define/HystrixCommandInstrumentation.java | 7 +++++++ .../hystrix/v1/define/HystrixPluginsInstrumentation.java | 7 +++++++ 6 files changed, 39 insertions(+), 1 deletion(-) diff --git a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/EnhanceRequireObjectCache.java b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/EnhanceRequireObjectCache.java index e6724beb98..2be967edea 100644 --- a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/EnhanceRequireObjectCache.java +++ b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/EnhanceRequireObjectCache.java @@ -20,6 +20,12 @@ package org.apache.skywalking.apm.plugin.hystrix.v1; import org.apache.skywalking.apm.agent.core.context.ContextSnapshot; +/** + * {@link EnhanceRequireObjectCache} record the prefix operation name of span and {@link ContextSnapshot} object for + * tracing. + * + * @author zhang xin + */ public class EnhanceRequireObjectCache { private final String operationNamePrefix; private ContextSnapshot contextSnapshot; diff --git a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/HystrixCommandConstructorInterceptor.java b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/HystrixCommandConstructorInterceptor.java index 161fb2cb0b..a6f4ecd06e 100644 --- a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/HystrixCommandConstructorInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/HystrixCommandConstructorInterceptor.java @@ -25,6 +25,13 @@ import com.netflix.hystrix.HystrixObservableCommand; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor; +/** + * {@link HystrixCommandConstructorInterceptor} get CommandKey or CollapserKey as the + * operation name prefix of span when the constructor that the class hierarchy com.netflix.hystrix.HystrixCommand + * invoked. + * + * @author zhang xin + */ public class HystrixCommandConstructorInterceptor implements InstanceConstructorInterceptor { @Override diff --git a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/HystrixPluginsInterceptor.java b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/HystrixPluginsInterceptor.java index 91a9bf8a93..d29b62fd4a 100644 --- a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/HystrixPluginsInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/HystrixPluginsInterceptor.java @@ -18,17 +18,23 @@ package org.apache.skywalking.apm.plugin.hystrix.v1; +import com.netflix.hystrix.strategy.HystrixPlugins; import com.netflix.hystrix.strategy.executionhook.HystrixCommandExecutionHook; import java.lang.reflect.Method; 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; +/** + * {@link HystrixPluginsInterceptor} wrapper the {@link HystrixCommandExecutionHook} object by using {@link + * SWExecutionHookWrapper} when the {@link HystrixPlugins#getCommandExecutionHook()} method invoked. + * + * @author zhang xin + */ public class HystrixPluginsInterceptor implements InstanceMethodsAroundInterceptor { @Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { - } @Override diff --git a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/SWExecutionHookWrapper.java b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/SWExecutionHookWrapper.java index ec8c824077..cc60c4ebd8 100644 --- a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/SWExecutionHookWrapper.java +++ b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/SWExecutionHookWrapper.java @@ -26,6 +26,11 @@ 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.network.trace.component.ComponentsDefine; +/** + * {@link SWExecutionHookWrapper} wrapper the HystrixCommandExecutionHook object for tracing. + * + * @author zhang xin + */ public class SWExecutionHookWrapper extends HystrixCommandExecutionHook { private final HystrixCommandExecutionHook actual; diff --git a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/define/HystrixCommandInstrumentation.java b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/define/HystrixCommandInstrumentation.java index ade25d491a..54c2faf72d 100644 --- a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/define/HystrixCommandInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/define/HystrixCommandInstrumentation.java @@ -28,6 +28,13 @@ import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; import static net.bytebuddy.matcher.ElementMatchers.any; import static org.apache.skywalking.apm.agent.core.plugin.match.HierarchyMatch.byHierarchyMatch; +/** + * {@link HystrixCommandInstrumentation} represent that the hystrix plugin intercept the constructor in the class that + * hierarchy {@link com.netflix.hystrix.HystrixCommand} class by using the {@link org.apache.skywalking.apm.plugin.hystrix.v1.HystrixCommandConstructorInterceptor} + * class. + * + * @author zhangxin + */ public class HystrixCommandInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { public static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.hystrix.v1.HystrixCommandConstructorInterceptor"; diff --git a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/define/HystrixPluginsInstrumentation.java b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/define/HystrixPluginsInstrumentation.java index 0c59115d4c..e7b82a9dee 100644 --- a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/define/HystrixPluginsInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/define/HystrixPluginsInstrumentation.java @@ -28,6 +28,13 @@ import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; import static net.bytebuddy.matcher.ElementMatchers.named; import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName; +/** + * {@link HystrixPluginsInstrumentation} represent that the hystrix plugin intercept the + * getCommandExecutionHook method in the {@link com.netflix.hystrix.strategy.HystrixPlugins} class class by + * using the {@link org.apache.skywalking.apm.plugin.hystrix.v1.HystrixCommandConstructorInterceptor} class. + * + * @author zhangxin + */ public class HystrixPluginsInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { public static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.hystrix.v1.HystrixPluginsInterceptor"; -- GitLab