From 192a414645197fcb0483cb8c29a7e9713374d44b Mon Sep 17 00:00:00 2001 From: wusheng Date: Tue, 22 Dec 2015 15:56:03 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=9A=84Spring?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E6=96=B9=E5=BC=8F=EF=BC=8C=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?API=E6=8C=87=E5=AF=BC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample-code/codeView.html | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/sample-code/codeView.html b/sample-code/codeView.html index 487ec08fe..243993e2c 100644 --- a/sample-code/codeView.html +++ b/sample-code/codeView.html @@ -19,21 +19,27 @@

如何追踪注册在Spring中类实例的方法调用?

-

1.在需要追踪的方法上,加上@Tracing标识。

+

1.Spring配置文件头部,配置所需的命名空间

-public class TracingAspectBean {
-
-    @Tracing
-    public String doBusiness() {
-        System.out.println("do business");
-        return "Hello World";
-    }
-}
-

注意:对于方法的追踪,仅限于实例级的public方法。其他方法由于Java运行时原因,无法追踪。

-

2.Spring配置文件中,配置所需如下信息。

+xmlns:skywalking="http://cloud.asiainfo.com/schema/skywalking" +xsi:schemaLocation="http://cloud.asiainfo.com/schema/skywalking + http://cloud.asiainfo.com/schema/skywalking/skywalking.xsd" +

典型Spring配置文件如下

+
<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xmlns:context="http://www.springframework.org/schema/context"
+	xmlns:skywalking="http://cloud.asiainfo.com/schema/skywalking"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans
+				http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+				http://www.springframework.org/schema/context
+				http://www.springframework.org/schema/context/spring-context-3.0.xsd
+				http://cloud.asiainfo.com/schema/skywalking
+				http://cloud.asiainfo.com/schema/skywalking/skywalking.xsd">
+

2.Spring配置文件中,设置需要追踪包名、类名或方法名。可配置多个。

-<bean id="tracingEnhance" class="com.ai.cloud.skywalking.plugin.spring.TracingEnhanceProcessor">
- +<skywalking:trace className="*" method="*" packageName="com.ai.cloud.skywalking.example.*" /> +<skywalking:trace className="busy*" method="*" packageName="com.ai.bss.example.*" /> +

注意:对于方法的追踪,仅限于实例级的public方法。其他方法由于Java运行时原因,无法追踪。

3.通过Spring标注,或配置文件将TracingAspectBean注册到Spring Context上下文中

如何追踪dubbo调用?