skywalking-java/sample-code/codeView.html

89 lines
4.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<title>Sky Walking Code View</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" type="text/css" href="../stylesheets/normalize.css" media="screen">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="../stylesheets/stylesheet.css" media="screen">
<link rel="stylesheet" type="text/css" href="../stylesheets/github-light.css" media="screen">
</head>
<body style="font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;margin:0;padding:0;font-size:16px;line-height:1.5">
<section class="page-header" style="background-image: url(../images/backgroud.png);padding: 0.5rem 1rem;text-align:center;">
<h2 style="color:#fff;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;line-height:1.5">Sky Walking Guide</h2>
</section>
<section class="main-content">
<h3>
<a id="useInSpring" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>如何追踪注册在Spring中类实例的本地方法调用
</h3>
<p>1.在需要追踪的方法上,加上@Tracing标识。</p>
<pre>
public class TracingAspectBean {
@Tracing
public String doBusiness() {
System.out.println("do business");
return "Hello World";
}
}</pre>
<p>2.Spring配置文件中配置所需如下信息。</p>
<pre>
&lt;bean id="tracingEnhance" class="com.ai.cloud.skywalking.plugin.spring.TracingEnhanceProcessor"&gt;</pre>
<h3>
<a id="useInDubbo" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>如何追踪dubbo调用
</h3>
<p>这里的dubbo专指阿里发布的已停止维护的标准dubbo版本<a href='http://dubbo.io'>dubbo.io</a>。扩展版本dubbox请参考相关章节。</p>
<p>在客户端和服务端配置全局filterswEnhanceFilter。</p>
<pre>
//客户端Spring配置文件
&lt;dubbo:consumer filter="swEnhanceFilter"/&gt;
//服务端Spring配置文件
&lt;dubbo:provider filter="swEnhanceFilter"/&gt;</pre>
<h3>
<a id="useInDubbox" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>如何追踪dubbox 2.8.4 调用?
</h3>
<p>dubbox 2.8.4 较为符合dubbo的服务规范这里指dubbox支持RpcContext中的attachment。追踪方式和dubbo相同。</p>
<p>在客户端和服务端配置全局filterswEnhanceFilter。</p>
<pre>
//客户端Spring配置文件
&lt;dubbo:consumer filter="swEnhanceFilter"/&gt;
//服务端Spring配置文件
&lt;dubbo:provider filter="swEnhanceFilter"/&gt;</pre>
<h3>
<a id="useInDubbox283" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>如何追踪dubbox 2.8.3 以及之前的调用?
</h3>
<p>由于引入dubbox主要目的是使用rest+json协议所以以下方案都是在此种调用模式下的解决方案。其他协议未测试请谅解望大家提供测试结果与反馈。</p>
<p>dubbox 2.8.3 以及之前版本不能正确的支持RpcContext中的attachment存在BUG2.8.4已修复)。采用扩展参数对象的方法支持追踪的传递性。</p>
<p><span style="color:red">注意依然推荐升级到dubbox 2.8.4,此时能更好的进行追踪,并对程序侵入性更小。</span></p>
<p>1.在客户端和服务端配置全局filterswEnhanceFilter。</p>
<pre>
//客户端Spring配置文件
&lt;dubbo:consumer filter="swEnhanceFilter"/&gt;
//服务端Spring配置文件
&lt;dubbo:provider filter="swEnhanceFilter"/&gt;</pre>
<p>2.在客户端和服务端启动时开启dubbox 2.8.3之前版本的修复功能。在服务启动前调用如下代码或将com.ai.cloud.skywalking.plugin.dubbox.bugfix.below283.BugFixAcitve注册到Spring中。</p>
<pre>
new com.ai.cloud.skywalking.plugin.dubbox.bugfix.below283.BugFixAcitve();</pre>
<p>3.dubbox调用参数包含javabean参数并继承com.ai.cloud.skywalking.plugin.dubbox.bugfix.below283.SWBaseBean。<span style="color:red">只包含java基础类型String、Integer等的调用无法支持追踪传递</span></p>
<p>4.客户端如果直接使用非dubbox客户端发起调用需要在发送的参数中设置contextData。</p>
<footer class="site-footer">
<span class="site-footer-owner"><a href="https://github.com/wu-sheng/sky-walking">Sky Walking</a> is maintained by <a href="https://github.com/wu-sheng">吴晟</a><a href="https://github.com/ascrutae">张鑫</a><a href="https://github.com/tanzhen84">谭真</a>.</span>
</footer>
</section>
</body>
</html>