This is an automated email from the ASF dual-hosted git repository.
dengliming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new ebeaa20 [ISSUE #1916] Agent main process (#1921)
ebeaa20 is described below
commit ebeaa2076600ea1d01a62d4fc258645d25cd6034
Author: YuDong Tang <[email protected]>
AuthorDate: Thu Aug 12 11:18:00 2021 +0800
[ISSUE #1916] Agent main process (#1921)
* add motan demo.
* add agent main process.
---
script/shenyu_checkstyle.xml | 2 +-
.../apache/shenyu/agent/spi/PluginAdviceDef.java} | 33 ++--
.../agent/bootstrap/ShenyuAgentBootstrap.java | 3 +
shenyu-agent/shenyu-agent-core/pom.xml | 7 +
.../org/apache/shenyu/agent/AgentInstaller.java | 81 ++++++++++
.../org/apache/shenyu/agent/enums/TraceTypes.java} | 22 +--
.../shenyu/agent/matcher/HasParentTypeMatcher.java | 167 +++++++++++++++++++++
.../shenyu/agent/matcher/SafeErasureMatcher.java | 82 ++++++++++
.../shenyu-agent-plugin-tracing-jaeger/pom.xml | 21 +++
.../tracing/jaeger/JaegerPluginAdviceDef.java} | 31 ++--
.../tracing/jaeger/advice/DoExecuteAdvice.java | 54 +++++++
.../agent/tracing/jaeger/advice/ExecuteAdvice.java | 54 +++++++
.../tracing/jaeger/advice/HandlerAdvice.java} | 31 ++--
13 files changed, 541 insertions(+), 47 deletions(-)
diff --git a/script/shenyu_checkstyle.xml b/script/shenyu_checkstyle.xml
index c1bca2b..a495396 100644
--- a/script/shenyu_checkstyle.xml
+++ b/script/shenyu_checkstyle.xml
@@ -153,7 +153,7 @@
<module name="FallThrough"/>
<module name="IllegalInstantiation"/>
<module name="IllegalCatch">
- <property name="illegalClassNames"
value="Error,Throwable,java.lang.Error,java.lang.Throwable" />
+ <property name="illegalClassNames" value="Error,java.lang.Error" />
</module>
<module name="IllegalThrows"/>
<module name="IllegalType">
diff --git
a/shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
b/shenyu-agent/shenyu-agent-api/src/main/java/org/apache/shenyu/agent/spi/PluginAdviceDef.java
similarity index 64%
copy from
shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
copy to
shenyu-agent/shenyu-agent-api/src/main/java/org/apache/shenyu/agent/spi/PluginAdviceDef.java
index 2dbc721..37b82df 100644
---
a/shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
+++
b/shenyu-agent/shenyu-agent-api/src/main/java/org/apache/shenyu/agent/spi/PluginAdviceDef.java
@@ -15,21 +15,32 @@
* limitations under the License.
*/
-package org.apache.shenyu.agent.bootstrap;
-
-import java.lang.instrument.Instrumentation;
+package org.apache.shenyu.agent.spi;
/**
- * The type Shenyu agent bootstrap.
+ * PluginAdviceDef.
*/
-public class ShenyuAgentBootstrap {
-
+public interface PluginAdviceDef {
+
+ /**
+ * return DoExecuteAdvice class name.
+ *
+ * @return DoExecuteAdvice name.
+ */
+ String getDoExecuteAdvice();
+
/**
- * Premain for instrumentation.
+ * return ExecuteAdvice class name.
*
- * @param arguments arguments
- * @param instrumentation instrumentation
+ * @return ExecuteAdvice name.
*/
- public static void premain(final String arguments, final Instrumentation
instrumentation) {
- }
+ String getExecuteAdvice();
+
+ /**
+ * return HandlerAdvice class name.
+ *
+ * @return HandlerAdvice name.
+ */
+ String getHandlerAdvice();
+
}
diff --git
a/shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
b/shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
index 2dbc721..d96b058 100644
---
a/shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
+++
b/shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
@@ -31,5 +31,8 @@ public class ShenyuAgentBootstrap {
* @param instrumentation instrumentation
*/
public static void premain(final String arguments, final Instrumentation
instrumentation) {
+ // todo create agent classloader and switch to it
+ // todo use reflect invoke AgentInstaller's method
installBytebuddyAgent
+ // todo turn back to prev classloader back
}
}
diff --git a/shenyu-agent/shenyu-agent-core/pom.xml
b/shenyu-agent/shenyu-agent-core/pom.xml
index 507267b..413d511 100644
--- a/shenyu-agent/shenyu-agent-core/pom.xml
+++ b/shenyu-agent/shenyu-agent-core/pom.xml
@@ -34,6 +34,13 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-agent-plugin-tracing-jaeger</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
diff --git
a/shenyu-agent/shenyu-agent-core/src/main/java/org/apache/shenyu/agent/AgentInstaller.java
b/shenyu-agent/shenyu-agent-core/src/main/java/org/apache/shenyu/agent/AgentInstaller.java
new file mode 100644
index 0000000..18dde34
--- /dev/null
+++
b/shenyu-agent/shenyu-agent-core/src/main/java/org/apache/shenyu/agent/AgentInstaller.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.shenyu.agent;
+
+import net.bytebuddy.agent.builder.AgentBuilder;
+import net.bytebuddy.description.type.TypeDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import net.bytebuddy.matcher.ElementMatchers;
+import org.apache.shenyu.agent.matcher.SafeErasureMatcher;
+import org.apache.shenyu.agent.matcher.HasParentTypeMatcher;
+import org.apache.shenyu.agent.spi.PluginAdviceDef;
+import org.apache.shenyu.agent.tracing.jaeger.JaegerPluginAdviceDef;
+
+import java.lang.instrument.Instrumentation;
+
+import static net.bytebuddy.matcher.ElementMatchers.isMethod;
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+/**
+ * AgentInstaller.
+ */
+public class AgentInstaller {
+
+ private static final String ABSTRACT_PLUGIN =
"org.apache.shenyu.plugin.base.AbstractShenyuPlugin";
+
+ private static final String WEB_HANDLER =
"org.apache.shenyu.web.handler.ShenyuWebHandler";
+
+ /**
+ * start to install agent.
+ *
+ * @param inst the instrumentation.
+ */
+ public static void installBytebuddyAgent(final Instrumentation inst) {
+ // todo load config from file or cmd args
+ // todo choose trace type according to config
+ // todo start trace exporter according to traceType
+ // todo start instrument(use spi to get advice class name)
+ PluginAdviceDef pluginAdviceDef = new JaegerPluginAdviceDef();
+ AgentBuilder agent = new AgentBuilder.Default()
+ .disableClassFormatChanges()
+ .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
+ .with(AgentBuilder.DescriptionStrategy.Default.POOL_ONLY);
+ agent =
agent.type(hasParentType(ElementMatchers.named(ABSTRACT_PLUGIN)))
+ .transform(new AgentBuilder.Transformer.ForAdvice()
+ .advice(isMethod().and(named("doExecute")),
pluginAdviceDef.getDoExecuteAdvice()));
+ agent =
agent.type(hasParentType(ElementMatchers.named(ABSTRACT_PLUGIN)))
+ .transform(new AgentBuilder.Transformer.ForAdvice()
+ .advice(isMethod().and(named("execute")),
pluginAdviceDef.getExecuteAdvice()));
+ agent = agent.type(ElementMatchers.named(WEB_HANDLER))
+ .transform(new AgentBuilder.Transformer.ForAdvice()
+ .advice(isMethod().and(named("handle")),
pluginAdviceDef.getHandlerAdvice()));
+ agent.installOn(inst);
+ }
+
+ /**
+ * has parent class matcher.
+ *
+ * @param matcher the Matcher.
+ * @return ElementMatcher.Junction.
+ */
+ public static ElementMatcher.Junction<TypeDescription> hasParentType(
+ final ElementMatcher<TypeDescription> matcher) {
+ return new HasParentTypeMatcher(new SafeErasureMatcher<>(matcher),
false);
+ }
+
+}
diff --git
a/shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
b/shenyu-agent/shenyu-agent-core/src/main/java/org/apache/shenyu/agent/enums/TraceTypes.java
similarity index 66%
copy from
shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
copy to
shenyu-agent/shenyu-agent-core/src/main/java/org/apache/shenyu/agent/enums/TraceTypes.java
index 2dbc721..604de03 100644
---
a/shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
+++
b/shenyu-agent/shenyu-agent-core/src/main/java/org/apache/shenyu/agent/enums/TraceTypes.java
@@ -15,21 +15,15 @@
* limitations under the License.
*/
-package org.apache.shenyu.agent.bootstrap;
-
-import java.lang.instrument.Instrumentation;
+package org.apache.shenyu.agent.enums;
/**
- * The type Shenyu agent bootstrap.
+ * TraceTypes.
*/
-public class ShenyuAgentBootstrap {
-
- /**
- * Premain for instrumentation.
- *
- * @param arguments arguments
- * @param instrumentation instrumentation
- */
- public static void premain(final String arguments, final Instrumentation
instrumentation) {
- }
+public enum TraceTypes {
+ OPENTELEMETRY,
+ OPENTRACING,
+ SKYWALKING,
+ ZIPKIN,
+ JAEGER
}
diff --git
a/shenyu-agent/shenyu-agent-core/src/main/java/org/apache/shenyu/agent/matcher/HasParentTypeMatcher.java
b/shenyu-agent/shenyu-agent-core/src/main/java/org/apache/shenyu/agent/matcher/HasParentTypeMatcher.java
new file mode 100644
index 0000000..59dde72
--- /dev/null
+++
b/shenyu-agent/shenyu-agent-core/src/main/java/org/apache/shenyu/agent/matcher/HasParentTypeMatcher.java
@@ -0,0 +1,167 @@
+/*
+ * 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.shenyu.agent.matcher;
+
+import net.bytebuddy.description.type.TypeDefinition;
+import net.bytebuddy.description.type.TypeDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * It can return has parent type class matcher.
+ */
+public class HasParentTypeMatcher extends
ElementMatcher.Junction.AbstractBase<TypeDescription> {
+
+ private final ElementMatcher<TypeDescription.Generic> matcher;
+
+ private final boolean interfacesOnly;
+
+ /**
+ * Creates a new matcher for a parent type.
+ *
+ * @param matcher The matcher to apply to any parent type of the matched
type.
+ */
+ public HasParentTypeMatcher(
+ final ElementMatcher<TypeDescription.Generic> matcher, final
boolean interfacesOnly) {
+ this.matcher = matcher;
+ this.interfacesOnly = interfacesOnly;
+ }
+
+ @Override
+ public boolean matches(final TypeDescription target) {
+ Set<TypeDescription> checkedInterfaces = new HashSet<>(8);
+ TypeDefinition typeDefinition = target;
+ while (typeDefinition != null) {
+ if (((!interfacesOnly || typeDefinition.isInterface())
+ && matcher.matches(typeDefinition.asGenericType()))
+ || hasInterface(typeDefinition, checkedInterfaces)) {
+ return true;
+ }
+ typeDefinition = safeGetParentClass(typeDefinition);
+ }
+ return false;
+ }
+
+ /**
+ * Matches a type's interfaces against the provided matcher.
+ *
+ * @param typeDefinition The type for which to check all implemented
interfaces.
+ * @param checkedInterfaces The interfaces that have already been checked.
+ * @return {@code true} if any interface matches the supplied matcher.
+ */
+ private boolean hasInterface(
+ final TypeDefinition typeDefinition, final Set<TypeDescription>
checkedInterfaces) {
+ for (TypeDefinition interfaceType : safeGetInterfaces(typeDefinition))
{
+ TypeDescription erasure = safeAsErasure(interfaceType);
+ if (erasure != null) {
+ if (checkedInterfaces.add(interfaceType.asErasure())
+ && (matcher.matches(interfaceType.asGenericType())
+ || hasInterface(interfaceType, checkedInterfaces))) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private static Iterable<TypeDefinition> safeGetInterfaces(final
TypeDefinition typeDefinition) {
+ return new SafeInterfaceIterator(typeDefinition);
+ }
+
+ static TypeDefinition safeGetParentClass(final TypeDefinition
typeDefinition) {
+ try {
+ return typeDefinition.getSuperClass();
+ } catch (Throwable e) {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof HasParentTypeMatcher)) {
+ return false;
+ }
+ HasParentTypeMatcher other = (HasParentTypeMatcher) obj;
+ return matcher.equals(other.matcher);
+ }
+
+ @Override
+ public int hashCode() {
+ return matcher.hashCode();
+ }
+
+ static TypeDescription safeAsErasure(final TypeDefinition typeDefinition) {
+ try {
+ return typeDefinition.asErasure();
+ } catch (Throwable e) {
+ return null;
+ }
+ }
+
+ private static final class SafeInterfaceIterator
+ implements Iterator<TypeDefinition>, Iterable<TypeDefinition> {
+
+ private final Iterator<TypeDescription.Generic> it;
+
+ private TypeDefinition next;
+
+ private SafeInterfaceIterator(final TypeDefinition typeDefinition) {
+ Iterator<TypeDescription.Generic> it = null;
+ try {
+ it = typeDefinition.getInterfaces().iterator();
+ } catch (Throwable ignored) {
+ }
+ this.it = it;
+ }
+
+ @Override
+ public boolean hasNext() {
+ if (null != it && it.hasNext()) {
+ try {
+ next = it.next();
+ return true;
+ } catch (Throwable e) {
+ return false;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public TypeDefinition next() {
+ return next;
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Iterator<TypeDefinition> iterator() {
+ return this;
+ }
+ }
+
+}
+
diff --git
a/shenyu-agent/shenyu-agent-core/src/main/java/org/apache/shenyu/agent/matcher/SafeErasureMatcher.java
b/shenyu-agent/shenyu-agent-core/src/main/java/org/apache/shenyu/agent/matcher/SafeErasureMatcher.java
new file mode 100644
index 0000000..97915bf
--- /dev/null
+++
b/shenyu-agent/shenyu-agent-core/src/main/java/org/apache/shenyu/agent/matcher/SafeErasureMatcher.java
@@ -0,0 +1,82 @@
+/*
+ * 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.shenyu.agent.matcher;
+
+import net.bytebuddy.description.type.TypeDefinition;
+import net.bytebuddy.description.type.TypeDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+
+/**
+ * Erasure matcher.
+ */
+public class SafeErasureMatcher<T extends TypeDefinition> extends
ElementMatcher.Junction.AbstractBase<T> {
+
+ /** The matcher to apply to the raw type of the matched element. */
+ private final ElementMatcher<TypeDescription> matcher;
+
+ /**
+ * Creates a new erasure matcher.
+ *
+ * @param matcher The matcher to apply to the raw type.
+ */
+ public SafeErasureMatcher(final ElementMatcher<TypeDescription> matcher) {
+ this.matcher = matcher;
+ }
+
+ @Override
+ public boolean matches(final T target) {
+ TypeDescription erasure = safeAsErasure(target);
+ if (erasure == null) {
+ return false;
+ } else {
+ // We would like matcher exceptions to propagate
+ return matcher.matches(erasure);
+ }
+ }
+
+ static TypeDescription safeAsErasure(final TypeDefinition typeDefinition) {
+ try {
+ return typeDefinition.asErasure();
+ } catch (Throwable e) {
+ return null;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "safeErasure(" + matcher + ")";
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof SafeErasureMatcher)) {
+ return false;
+ }
+ SafeErasureMatcher<?> other = (SafeErasureMatcher<?>) obj;
+ return matcher.equals(other.matcher);
+ }
+
+ @Override
+ public int hashCode() {
+ return matcher.hashCode();
+ }
+}
+
diff --git
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/pom.xml
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/pom.xml
index 92e40d3..36c4adc 100644
---
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/pom.xml
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/pom.xml
@@ -27,4 +27,25 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>shenyu-agent-plugin-tracing-jaeger</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-agent-api</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-plugin-base</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-web</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
</project>
\ No newline at end of file
diff --git
a/shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/src/main/java/org/apache/shenyu/agent/tracing/jaeger/JaegerPluginAdviceDef.java
similarity index 57%
copy from
shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
copy to
shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/src/main/java/org/apache/shenyu/agent/tracing/jaeger/JaegerPluginAdviceDef.java
index 2dbc721..0f9db5f 100644
---
a/shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/src/main/java/org/apache/shenyu/agent/tracing/jaeger/JaegerPluginAdviceDef.java
@@ -15,21 +15,28 @@
* limitations under the License.
*/
-package org.apache.shenyu.agent.bootstrap;
+package org.apache.shenyu.agent.tracing.jaeger;
-import java.lang.instrument.Instrumentation;
+import org.apache.shenyu.agent.spi.PluginAdviceDef;
/**
- * The type Shenyu agent bootstrap.
+ * JaegerPluginAdviceDef.
*/
-public class ShenyuAgentBootstrap {
-
- /**
- * Premain for instrumentation.
- *
- * @param arguments arguments
- * @param instrumentation instrumentation
- */
- public static void premain(final String arguments, final Instrumentation
instrumentation) {
+public class JaegerPluginAdviceDef implements PluginAdviceDef {
+
+ @Override
+ public String getDoExecuteAdvice() {
+ return "org.apache.shenyu.agent.tracing.jaeger.advice.DoExecuteAdvice";
+ }
+
+ @Override
+ public String getExecuteAdvice() {
+ return "org.apache.shenyu.agent.tracing.jaeger.advice.ExecuteAdvice";
}
+
+ @Override
+ public String getHandlerAdvice() {
+ return "org.apache.shenyu.agent.tracing.jaeger.advice.HandlerAdvice";
+ }
+
}
diff --git
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/src/main/java/org/apache/shenyu/agent/tracing/jaeger/advice/DoExecuteAdvice.java
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/src/main/java/org/apache/shenyu/agent/tracing/jaeger/advice/DoExecuteAdvice.java
new file mode 100644
index 0000000..862cac6
--- /dev/null
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/src/main/java/org/apache/shenyu/agent/tracing/jaeger/advice/DoExecuteAdvice.java
@@ -0,0 +1,54 @@
+/*
+ * 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.shenyu.agent.tracing.jaeger.advice;
+
+import net.bytebuddy.asm.Advice;
+import org.apache.shenyu.plugin.base.AbstractShenyuPlugin;
+
+/**
+ * DoExecuteAdvice.
+ */
+public class DoExecuteAdvice {
+
+ /**
+ * onEnter.
+ *
+ * @param args args.
+ * @param target the target class.
+ */
+ @Advice.OnMethodEnter(suppress = Throwable.class)
+ public static void onEnter(
+ @Advice.AllArguments final Object[] args,
+ @Advice.This final AbstractShenyuPlugin target) {
+ String pluginName = target.named();
+ }
+
+ /**
+ * onExit.
+ *
+ * @param throwable throw.
+ * @param args args.
+ * @param target the target class.
+ */
+ @Advice.OnMethodExit(onThrowable = Throwable.class, suppress =
Throwable.class)
+ public static void onExit(
+ @Advice.Thrown final Throwable throwable,
+ @Advice.AllArguments final Object[] args,
+ @Advice.This final Object target) {
+ }
+}
diff --git
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/src/main/java/org/apache/shenyu/agent/tracing/jaeger/advice/ExecuteAdvice.java
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/src/main/java/org/apache/shenyu/agent/tracing/jaeger/advice/ExecuteAdvice.java
new file mode 100644
index 0000000..3cdf236
--- /dev/null
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/src/main/java/org/apache/shenyu/agent/tracing/jaeger/advice/ExecuteAdvice.java
@@ -0,0 +1,54 @@
+/*
+ * 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.shenyu.agent.tracing.jaeger.advice;
+
+import net.bytebuddy.asm.Advice;
+import org.apache.shenyu.plugin.base.AbstractShenyuPlugin;
+
+/**
+ * ExecuteAdvice.
+ */
+public class ExecuteAdvice {
+
+ /**
+ * onEnter.
+ *
+ * @param args args.
+ * @param target the target class.
+ */
+ @Advice.OnMethodEnter(suppress = Throwable.class)
+ public static void onEnter(
+ @Advice.AllArguments final Object[] args,
+ @Advice.This final AbstractShenyuPlugin target) {
+ String pluginName = target.named();
+ }
+
+ /**
+ * onExit.
+ *
+ * @param throwable throw.
+ * @param args args.
+ * @param target the target class.
+ */
+ @Advice.OnMethodExit(onThrowable = Throwable.class, suppress =
Throwable.class)
+ public static void onExit(
+ @Advice.Thrown final Throwable throwable,
+ @Advice.AllArguments final Object[] args,
+ @Advice.This final Object target) {
+ }
+}
diff --git
a/shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/src/main/java/org/apache/shenyu/agent/tracing/jaeger/advice/HandlerAdvice.java
similarity index 53%
copy from
shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
copy to
shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/src/main/java/org/apache/shenyu/agent/tracing/jaeger/advice/HandlerAdvice.java
index 2dbc721..28ff0ff 100644
---
a/shenyu-agent/shenyu-agent-bootstrap/src/main/java/org/apache/shenyu/agent/bootstrap/ShenyuAgentBootstrap.java
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/shenyu-agent-plugin-tracing-jaeger/src/main/java/org/apache/shenyu/agent/tracing/jaeger/advice/HandlerAdvice.java
@@ -15,21 +15,34 @@
* limitations under the License.
*/
-package org.apache.shenyu.agent.bootstrap;
+package org.apache.shenyu.agent.tracing.jaeger.advice;
-import java.lang.instrument.Instrumentation;
+import net.bytebuddy.asm.Advice;
+import org.springframework.web.server.ServerWebExchange;
/**
- * The type Shenyu agent bootstrap.
+ * HandlerAdvice.
*/
-public class ShenyuAgentBootstrap {
-
+public class HandlerAdvice {
+
+ /**
+ * onEnter.
+ *
+ * @param exchange exchange.
+ */
+ @Advice.OnMethodEnter(suppress = Throwable.class)
+ public static void onEnter(@Advice.Argument(0) final ServerWebExchange
exchange) {
+ }
+
/**
- * Premain for instrumentation.
+ * onExit.
*
- * @param arguments arguments
- * @param instrumentation instrumentation
+ * @param throwable throw.
+ * @param exchange exchange.
*/
- public static void premain(final String arguments, final Instrumentation
instrumentation) {
+ @Advice.OnMethodExit(onThrowable = Throwable.class, suppress =
Throwable.class)
+ public static void onExit(
+ @Advice.Thrown final Throwable throwable,
+ @Advice.Argument(0) final ServerWebExchange exchange) {
}
}