<section id="nice" data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="word-spacing: 0px; word-break: break-word; word-wrap: break-word; font-size: 16px; line-height: 1.75em; letter-spacing: 0.5px; text-align: justify; color: #3f3f3f; padding: 0 8px 0 8px; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif !important;"><p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">传统 APM 聚焦在代码层面,不具备全栈多维度无盲点看问题的能力,同时由于插码的阻碍往往难以覆盖所有微服务,DeepFlow 依靠 eBPF 零代码修改采集全栈追踪数据并聚合生成了调用关系,可以增强传统 APM 的数据,大大缩短问题定界时间。对于已经使用传统 APM 工具的用户,可以考虑使用 DeepFlow 提供的 API 来增强应用依赖拓扑及调用追踪,以获得全栈数据追踪能力。</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">本文以 SkyWalking 为例从落地实现角度来描述,如何将在传统 APM 中集成 DeepFlow 的数据,增强传统 APM 数据能力, 主要从以下两个角度来:</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px; padding-left: 25px; list-style-type: disc; color: #1d51ce; margin: 0; margin-bottom: 27px;"> <li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">依赖拓扑:增强查看某历史时间范围内服务(POD)到服务(POD)全栈路径拓扑以及全景上下游拓扑。</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">调用链追踪:增强查看某个应用 Span 对应系统 Span、网络 Span 时延消耗以及追踪未插码服务的能力。</section></li></ul> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">开启下文的阅读之前,需要对 DeepFlow 目前已有的数据及术语有了解,下文默认读者都有一定的认知。</p> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 34px; color: #1d51ce; margin-bottom: 0; margin-top: calc(2 * 27px);"><span class="prefix" style="display: none;"></span><span class="content">01</span><span class="suffix"></span></h1> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 18px; margin-top: 5px; margin-bottom: 32px; color: #1d51ce;"><span class="prefix" style="display: none;"></span><span class="content">全栈路径拓扑-界面</span><span class="suffix"></span></h1> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">增强查看某历史时间范围内服务(POD)到服务(POD)应用和网络指标量能力,可以快速回答在某一段时间内端到端路径是否存在瓶颈点,下面将结合 Skywalking 介绍产品 UI 界面如何融合</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">第一步:聚焦需要查看的路径(以下举例通过拓扑图路径点击,大家可以根据环境的实际情况来定义使用流程)</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/202303206418810baf391.png" alt="聚焦需要查看的路径" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">聚焦需要查看的路径</figcaption></figure> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230322641b129db53c1.jpg" alt="点击全栈路径拓扑" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">点击全栈路径拓扑</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">第二步:查看全栈路径拓扑(增强能力)</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230322641b129d0a8c2.jpg" alt="查看全栈路径拓扑" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">查看全栈路径拓扑</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">上图拓扑中每一个节点都对应一个统计位置(tap_side),<span class="footnote-word" style="font-weight: bold; color: #3f3f3f;">统计位置的说明参考 DeepFlow 官网的线上文档</span><sup class="footnote-ref" style="line-height: 0; font-weight: bold; color: #3f3f3f;">[1]</sup>,以<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">客户端容器节点</code>举例说明具体的含义,表达是 cartservice 服务访问 redis-cart 服务,在 cartservice 对应 POD 所在的容器节点上采集到的访问数据,然后聚合的指标量。上图查看的指标量为<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">响应时延</code>,不难看出瓶颈在服务端容器网络,判断过程如下:</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px; padding-left: 25px; list-style-type: disc; color: #1d51ce; margin: 0; margin-bottom: 27px;"> <li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">客户端时延:④=204.31ms,为请求服务端的总时延,由以下几部分组成 <ul style="margin-top: 8px; padding-left: 25px; color: #1d51ce; margin: 0; margin-bottom: 27px; list-style-type: square;"> <li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">客户端容器网络:路径①(也就是⑤-④),图中所示为38.14us</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">云网络:路径②(也就是⑥-⑤),图中所示为273.13us</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">服务端容器网络:路径③(也就是⑦-⑥),图中所示为204.25ms</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">服务端:即图中⑦,为372.83us</section></li></ul> </section></li></ul> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 34px; color: #1d51ce; margin-bottom: 0; margin-top: calc(2 * 27px);"><span class="prefix" style="display: none;"></span><span class="content">02</span><span class="suffix"></span></h1> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 18px; margin-top: 5px; margin-bottom: 32px; color: #1d51ce;"><span class="prefix" style="display: none;"></span><span class="content">全栈路径拓扑-API</span><span class="suffix"></span></h1> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">结合 API 看看如何实现,DeepFlow 的所有数据均可通过 SQL API 获取。</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">调用方输入<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">客户端名称</code>、<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">服务端名称</code>、<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">指标量</code>以及<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">时间范围</code>作为 API 的搜索条件即可获得<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">全栈路径拓扑</code>数据。</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">第一步:获取 Skywalking 路径的<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">客户端服务及服务端名称</code>,根据需求明确需要查看的<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">指标量</code>及查看的<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">时间范围</code></p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230322641b129784761.jpg" alt="Skywalking 输入" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">Skywalking 输入</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">第二步:查询 DeepFlow 获取应用/网络统计位置的数据,<span class="footnote-word" style="font-weight: bold; color: #3f3f3f;">SQL 调用参考 DeepFlow 官网的线上文档</span><sup class="footnote-ref" style="line-height: 0; font-weight: bold; color: #3f3f3f;">[2]</sup></p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; color: #376bb4; background-color: #f3f3f3; padding-top: 15px; background: #282c34; border-radius: 5px;">SELECT Avg(`request`), /* 需要查看的指标量 */ <br> pod_service_0, /* 客户端服务名称,客户端为 POD,则替换为 pod_0 */<br> tap_side, <br> pod_service_1 /* 服务端服务名称,服务端为 POD,则替换为 pod_1 */<br>FROM vtap_app_edge_port /* 查看应用指标使用 vtap_app_edge_port;查看网络指标切换到 vtap_flow_edge_port */<br>WHERE time>=1678760220 AND time<=1678762020 AND <br> pod_service_0=<span class="hljs-string" style="color: #98c379; line-height: 26px;">'deepflow-server'</span> AND /* 过滤客户端 */<br> pod_service_1=<span class="hljs-string" style="color: #98c379; line-height: 26px;">'deepflow-server'</span> /* 过滤服务端 */<br>GROUP BY pod_service_0, <br> tap_side, <br> pod_service_1,<br></code></pre> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">第三步:根据返回数据绘制拓扑图</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">每个 tap_side 对应一个节点,节点根据 <code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">c-app/app/c-p/c/c-nd/c-hv/c-gw-hv/c-gw/local/rest/s-gw/s-gw-hv/s-hv/s-nd/s/s-p/s-app</code> 从左到右排序,每个节点独立显示<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">指标数据</code>。</p> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 34px; color: #1d51ce; margin-bottom: 0; margin-top: calc(2 * 27px);"><span class="prefix" style="display: none;"></span><span class="content">03</span><span class="suffix"></span></h1> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 18px; margin-top: 5px; margin-bottom: 32px; color: #1d51ce;"><span class="prefix" style="display: none;"></span><span class="content">全景上下游拓扑-界面</span><span class="suffix"></span></h1> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">增强某节点查看全景上下游拓扑的能力,可快速发现未插码范围内被谁访问了(比如追踪上游的 Nginx 网关、安全策略未防住的访问等等),以及自身访问了谁,下面也将结合 Skywalking 介绍产品 UI 界面如何融合</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">第一步:聚焦需要查看的节点(以下举例通过拓扑图节点点击,大家可以根据环境的实际情况来定义使用流程)</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230324641d30f785077.jpg" alt="点击全景上下游拓扑" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">点击全景上下游拓扑</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">第二步:查看全景上下游拓扑(增强能力)</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230324641d30ebca616.jpg" alt="查看全景上下游拓扑" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">查看全景上下游拓扑</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">上图为 tikcet-web 服务的全景上下游拓扑,其中 ① 是未插码的 ingress-nginx-controller 服务,表明 ticket-web 服务对外都是通过 ingress 来访问的,其中 ② 为未插码的 kube-dns 服务,经常访问服务慢,可能是因为 DNS 解析慢,而在应用拓扑是无法看出来此信息的。</p> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 34px; color: #1d51ce; margin-bottom: 0; margin-top: calc(2 * 27px);"><span class="prefix" style="display: none;"></span><span class="content">04</span><span class="suffix"></span></h1> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 18px; margin-top: 5px; margin-bottom: 32px; color: #1d51ce;"><span class="prefix" style="display: none;"></span><span class="content">全景上下游拓扑-API</span><span class="suffix"></span></h1> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">调用方输入<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">服务名称</code>、<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">指标量</code>以及<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">时间范围</code>作为 API 的搜索条件即可获得<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">全景上下游拓扑</code>数据,需要两次调用的 DeepFlow API,分别获取到上游和下游的数据如下:</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">获取上游数据</p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; color: #376bb4; background-color: #f3f3f3; padding-top: 15px; background: #282c34; border-radius: 5px;">SELECT Avg(`request`), /* 需要查看的指标量 */ <br> pod_service_0, /* 客户端服务名称,客户端为 POD,则替换为 pod_0 */<br> tap_side, <br> pod_service_1 /* 服务端服务名称,服务端为 POD,则替换为 pod_1 */<br>FROM vtap_app_edge_port /* 查看应用指标使用 vtap_app_edge_port;查看网络指标切换到 vtap_flow_edge_port */<br>WHERE time>=1678760220 AND time<=1678762020 AND <br> pod_service_1=<span class="hljs-string" style="color: #98c379; line-height: 26px;">'deepflow-server'</span> /* 需要查看上游数据的服务 */<br>GROUP BY pod_service_0, <br> tap_side, <br> pod_service_1,<br></code></pre> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">获取下游数据</p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; color: #376bb4; background-color: #f3f3f3; padding-top: 15px; background: #282c34; border-radius: 5px;">SELECT Avg(`request`), /* 需要查看的指标量 */ <br> pod_service_0, /* 客户端服务名称,客户端为 POD,则替换为 pod_0 */<br> tap_side, <br> pod_service_1 /* 服务端服务名称,服务端为 POD,则替换为 pod_1 */<br>FROM vtap_app_edge_port /* 查看应用指标使用 vtap_app_edge_port;查看网络指标切换到 vtap_flow_edge_port */<br>WHERE time>=1678760220 AND time<=1678762020 AND <br> pod_service_0=<span class="hljs-string" style="color: #98c379; line-height: 26px;">'deepflow-server'</span> /* 需要查看下游数据的服务 */<br>GROUP BY pod_service_0, <br> tap_side, <br> pod_service_1,<br></code></pre> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 34px; color: #1d51ce; margin-bottom: 0; margin-top: calc(2 * 27px);"><span class="prefix" style="display: none;"></span><span class="content">05</span><span class="suffix"></span></h1> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 18px; margin-top: 5px; margin-bottom: 32px; color: #1d51ce;"><span class="prefix" style="display: none;"></span><span class="content">调用链追踪-产品</span><span class="suffix"></span></h1> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">在开始介绍如何增强调用追踪的数据之前,先结合一张图说明一些后续要使用到的术语</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230322641b12997f6f0.jpg" alt="数据介绍图" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">数据介绍图</figcaption></figure> <ul data-tool="mdnice编辑器" style="margin-top: 8px; padding-left: 25px; list-style-type: disc; color: #1d51ce; margin: 0; margin-bottom: 27px;"> <li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">图中 A 表示应用 Span(来源传统 APM);S 表示网络 Span(来源 DeepFlow);N 表示网络 Span(来源 DeepFlow)</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">图中黑色部分为发起全栈调用追踪的的应用 Span,后续统称为 <code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">应用 Span Y</code></section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">图中蓝色部分为通过 <code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">应用 Span Y</code> 追踪的路径中的系统和网络 Span</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">图中绿色部分为通过 <code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">应用 Span Y</code> 追踪的下游未插码的 Span</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">图中红色部分为通过 <code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">应用 Span Y</code> 追踪的上游未插码的 Span</section></li></ul> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">接下来将分别来讨论上图中蓝色/绿色/红色部分如何基于 SkyWalking 产品做 UI 融合(注:以下产品 UI 部分仅为示意图):</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;"><strong style="font-weight: bold; color: #4e6cb4;">第一步:聚焦需要查看的应用 Span</strong>(以下举例通过点击 Span,大家可以根据环境的实际情况来定义使用流程)</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/2022090163106732aa4b4.jpg" alt="聚焦需要查看的路径" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">聚焦需要查看的路径</figcaption></figure> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/2023032064188109ae578.png" alt="点击全栈调用追踪" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">点击全栈调用追踪</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;"><strong style="font-weight: bold; color: #4e6cb4;">第二步:查看全栈调用拓扑</strong>(增强能力)</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230322641b196f4ec5c.jpg" alt="查看全栈调用拓扑" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">查看全栈调用拓扑</figcaption></figure> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 34px; color: #1d51ce; margin-bottom: 0; margin-top: calc(2 * 27px);"><span class="prefix" style="display: none;"></span><span class="content">06</span><span class="suffix"></span></h1> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 18px; margin-top: 5px; margin-bottom: 32px; color: #1d51ce;"><span class="prefix" style="display: none;"></span><span class="content">调用链追踪-API</span><span class="suffix"></span></h1> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">接下来看下结合 DeepFlow 的 SQL API 如何实现,基于前面的术语介绍图,可知传统 APM 结合 DeepFlow 的数据来完成全栈调用追踪的能力,需要分蓝色、绿色和红色三部分来实现,接下来将分开介绍这三部分的数据实现。</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">蓝色部分:<strong style="font-weight: bold; color: #4e6cb4;">根据 应用 Span 的 TraceID + SpanID 追踪 DeepFlow 的系统 Span 和网络 Span</strong>,可以方便的查看某次调用在系统和网络分布消耗的时延,快速定界问题。可以通过 TraceID、SpanID 作为搜索条件获取 DeepFlow 的系统和网络 Span</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230322641b1299c784e.jpg" alt="蓝色部分-追踪图" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">蓝色部分-追踪图</figcaption></figure> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; color: #376bb4; background-color: #f3f3f3; padding-top: 15px; background: #282c34; border-radius: 5px;">SELECT response_duration,<br> start_time,<br> end_time,<br> resource_gl0_0, /* 客户端 */<br> resource_gl0_1, /* 服务端 */<br> tap_port_type, /* eBPF、NIC ... */<br> tap_port, /* NIC Name */<br> trace_id,<br> span_id<br>FROM l7_flow_log<br>WHERE trace_id = <span class="hljs-string" style="color: #98c379; line-height: 26px;">'c5ad367da7ed41fc97921d91a0584bd8.63.16620935428909473'</span> AND<br> span_id = <span class="hljs-string" style="color: #98c379; line-height: 26px;">'e05ee7a06d674085a16dfea36ed11b98.169.16620935428971714-2'</span> AND /* 非必须,精确搜索 */<br> time >= 1662093572 AND time <= 1662095372 /* 加速搜索 */<br></code></pre> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">此部分的细节部分可以参考<span class="footnote-word" style="font-weight: bold; color: #3f3f3f;">DeepFlow 让 SkyWalking 分布式追踪无盲点</span><sup class="footnote-ref" style="line-height: 0; font-weight: bold; color: #3f3f3f;">[3]</sup>。</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">红色部分:<strong style="font-weight: bold; color: #4e6cb4;">增强某个应用 Span 上游的 Span,对于插码范围以外(之前)的部分</strong>,例如追踪出来从未插码的客户端 Span</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230322641b129a7eae7.jpg" alt="红色部分-追踪原理解释图" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">红色部分-追踪原理解释图</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">对于这部分数据的追踪,需要分几个步骤来逐一进行关联</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px; padding-left: 25px; list-style-type: disc; color: #1d51ce; margin: 0; margin-bottom: 27px;"> <li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">① 根据<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">应用 Span Y</code> 的 TraceID + SpanID 追踪 DeepFlow 的系统 Span,此时可能会得到多个系统 Span,只需要获取与<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">应用 Span Y</code>紧邻的<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">系统 Span X</code>继续往下追踪即可(可通过总时延最长来判断)</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">② 获取<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">系统 Span X</code>的 syscall_trace_id_request 作为其他系统 Span 的搜索条件,得到<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">系统 Span Z</code></section></li></ul> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; color: #376bb4; background-color: #f3f3f3; padding-top: 15px; background: #282c34; border-radius: 5px;">SELECT response_duration, /* SELECT 字段可以根据需求自定义即可*/<br> l7_protocol,<br> Enum(request_type),<br> request_resource,<br> process_kname_0,<br> process_kname_1,<br> tap_side,<br> req_tcp_seq, <br> resp_tcp_seq,<br> Enum(auto_instance_type_0) AS `client_Enum(auto_instance_type_0)`,<br> auto_instance_0, <br> Enum(auto_instance_type_1) AS `server_Enum(auto_instance_type_1)`, <br> auto_instance_1, <br>FROM l7_flow_log <br>WHERE time>=1678764261 AND /*追踪开始时间,建议设置比系统 Span X 的开始时间早 3min*/<br> time<=1678767861 AND /*追踪结束时间,建议设置比系统 Span X 的结束时间晚 3min*//<br> (syscall_trace_id_request=16787489195430278) /* 16787489195430278 为 系统 Span Y 的 syscall_trace_id_request */<br>ORDER BY `end_time` <br><br></code></pre> <ul data-tool="mdnice编辑器" style="margin-top: 8px; padding-left: 25px; list-style-type: disc; color: #1d51ce; margin: 0; margin-bottom: 27px;"> <li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">③ 获取<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">系统 Span Z</code> 的 req_tcp_seq/resp_tcp_seq 作为其他系统 Span 和网络 Span 的搜索条件,得到<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">网络 Span Z.1/Z.2 以及系统 Span Q</code>,此处逻辑特别注意:req_tcp_seq !=0 & resp_tcp_seq !=0 则需要同时满足 req_tcp_seq 和 resp_tcp_seq;如果其中一个为 0,则任意满足一个即可</section></li></ul> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; color: #376bb4; background-color: #f3f3f3; padding-top: 15px; background: #282c34; border-radius: 5px;">SELECT response_duration, /* SELECT 字段可以根据需求自定义即可*/<br> l7_protocol,<br> Enum(request_type),<br> request_resource,<br> process_kname_0,<br> process_kname_1,<br> tap_side,<br> req_tcp_seq, <br> resp_tcp_seq,<br> Enum(auto_instance_type_0) AS `client_Enum(auto_instance_type_0)`,<br> auto_instance_0, <br> Enum(auto_instance_type_1) AS `server_Enum(auto_instance_type_1)`, <br> auto_instance_1, <br>FROM l7_flow_log <br>WHERE time>=1678764261 AND <br> time<=1678767861 AND <br> (<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">type</span>=2 AND <br> req_tcp_seq=3575241005 AND /* 3575241005 为系统 Span Z 的 req_tcp_seq*/<br> resp_tcp_seq=995863176) /* 995863176 为系统 Span Z 的 resp_tcp_seq*/<br>ORDER BY `end_time` <br></code></pre> <ul data-tool="mdnice编辑器" style="margin-top: 8px; padding-left: 25px; list-style-type: disc; color: #1d51ce; margin: 0; margin-bottom: 27px;"> <li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">④ 接下来可继续追踪<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">系统 Span Q</code> 的上游系统 Span,这里将分两种情况,如果上游的系统 Span 与<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">系统 Span Q</code> 在同一个线程,则重复步骤 [2]/[3] 即可,如果在不同线程/进程中,目前仅支持网关设置了 X-Request-ID 的情况下继续追踪,获取<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">系统 Span Q</code>的 x-request-id 作为查询其他系统 Span 和网络 Span 的搜索条件,得到其上游的<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">系统 Span M</code></section></li></ul> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; color: #376bb4; background-color: #f3f3f3; padding-top: 15px; background: #282c34; border-radius: 5px;">SELECT response_duration, /* SELECT 字段可以根据需求自定义即可*/<br> l7_protocol,<br> Enum(request_type),<br> request_resource,<br> process_kname_0,<br> process_kname_1,<br> tap_side,<br> req_tcp_seq, <br> resp_tcp_seq,<br> Enum(auto_instance_type_0) AS `client_Enum(auto_instance_type_0)`,<br> auto_instance_0, <br> Enum(auto_instance_type_1) AS `server_Enum(auto_instance_type_1)`, <br> auto_instance_1, <br>FROM l7_flow_log <br>WHERE time>=1678764261 AND <br> time<=1678767861 AND <br> x_request_id=6e903947-5ef0-4c63-91a8-a2a599171633 /* 6e903947-5ef0-4c63-91a8-a2a599171633 为系统 Span Q 的 x_request_id*/<br>ORDER BY `end_time` <br></code></pre> <ul data-tool="mdnice编辑器" style="margin-top: 8px; padding-left: 25px; list-style-type: disc; color: #1d51ce; margin: 0; margin-bottom: 27px;"> <li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">⑤ 到此,已经根据上述步骤追踪得到所有的上游 Span,接下来将确定父子关系,可直接根据总的响应时延,按从大到小降序排列即可</section></li></ul> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">绿色部分:<strong style="font-weight: bold; color: #4e6cb4;">增强某个应用 Span 下游的 Span,对于插码范围以外(之后)的部分追踪</strong>,例如追踪出来未插码的服务端 Span(DNS),此追踪过程与<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">红色部分</code>非常相似,仅步骤 ② 中的<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">syscall_trace_id_request</code>换成<code style="font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #376bb4; background-color: #f3f3f3;">syscall_trace_id_response</code>即可,此处不在赘述。</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230322641b12980913c.jpg" alt="绿色部分-追踪图" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">绿色部分-追踪图</figcaption></figure> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 34px; color: #1d51ce; margin-bottom: 0; margin-top: calc(2 * 27px);"><span class="prefix" style="display: none;"></span><span class="content">07</span><span class="suffix"></span></h1> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 18px; margin-top: 5px; margin-bottom: 32px; color: #1d51ce;"><span class="prefix" style="display: none;"></span><span class="content">什么是 DeepFlow</span><span class="suffix"></span></h1> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;"><span class="footnote-word" style="font-weight: bold; color: #3f3f3f;">DeepFlow</span><sup class="footnote-ref" style="line-height: 0; font-weight: bold; color: #3f3f3f;">[4]</sup> 是一款开源的高度自动化的可观测性平台,是为云原生应用开发者建设可观测性能力而量身打造的全栈、全链路、高性能数据引擎。DeepFlow 使用 eBPF、WASM、OpenTelemetry 等新技术,创新的实现了 AutoTracing、AutoMetrics、AutoTagging、SmartEncoding 等核心机制,帮助开发者提升埋点插码的自动化水平,降低可观测性平台的运维复杂度。利用 DeepFlow 的可编程能力和开放接口,开发者可以快速将其融入到自己的可观测性技术栈中。</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">GitHub 地址:https://github.com/deepflowys/deepflow</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">访问 <span class="footnote-word" style="font-weight: bold; color: #3f3f3f;">DeepFlow Demo</span><sup class="footnote-ref" style="line-height: 0; font-weight: bold; color: #3f3f3f;">[5]</sup>,体验高度自动化的可观测性新时代。</p> <h3 class="footnotes-sep" data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; margin: 0; padding: 0; font-size: 16px; color: #1d51ce; border-left: 3px solid #1d51ce; padding-left: 8px;"><span style="display: block;">参考资料</span></h3> <section class="footnotes" data-tool="mdnice编辑器" style="margin: 0; padding: 0;"> <span id="fn1" class="footnote-item" style="display: flex;"><span class="footnote-num" style="display: inline; width: 10%; background: none; font-size: 80%; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;">[1] </span><p style="padding-top: 8px; padding-bottom: 8px; margin-bottom: 27px; display: inline; font-size: 14px; width: 90%; padding: 0px; margin: 0; line-height: 26px; word-break: break-all; width: calc(100%-50); color: #1d51ce;">统计位置的说明参考 DeepFlow 官网的线上文档: <em style="font-style: italic; color: #888888;">https://deepflow.io/docs/zh/auto-metrics/metrics-without-instrumentation/</em></p> </span> <span id="fn2" class="footnote-item" style="display: flex;"><span class="footnote-num" style="display: inline; width: 10%; background: none; font-size: 80%; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;">[2] </span><p style="padding-top: 8px; padding-bottom: 8px; margin-bottom: 27px; display: inline; font-size: 14px; width: 90%; padding: 0px; margin: 0; line-height: 26px; word-break: break-all; width: calc(100%-50); color: #1d51ce;">SQL 调用参考 DeepFlow 官网的线上文档: <em style="font-style: italic; color: #888888;">https://deepflow.io/docs/zh/server-integration/query/sql/</em></p> </span> <span id="fn3" class="footnote-item" style="display: flex;"><span class="footnote-num" style="display: inline; width: 10%; background: none; font-size: 80%; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;">[3] </span><p style="padding-top: 8px; padding-bottom: 8px; margin-bottom: 27px; display: inline; font-size: 14px; width: 90%; padding: 0px; margin: 0; line-height: 26px; word-break: break-all; width: calc(100%-50); color: #1d51ce;">DeepFlow 让 SkyWalking 分布式追踪无盲点: <em style="font-style: italic; color: #888888;">https://deepflow.io/blog/007-skywalking-distributed-tracing-without-blind-spots/#0x1-DeepFlow-SQL-API</em></p> </span> <span id="fn4" class="footnote-item" style="display: flex;"><span class="footnote-num" style="display: inline; width: 10%; background: none; font-size: 80%; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;">[4] </span><p style="padding-top: 8px; padding-bottom: 8px; margin-bottom: 27px; display: inline; font-size: 14px; width: 90%; padding: 0px; margin: 0; line-height: 26px; word-break: break-all; width: calc(100%-50); color: #1d51ce;">DeepFlow: <em style="font-style: italic; color: #888888;">https://github.com/deepflowys/deepflow</em></p> </span> <span id="fn5" class="footnote-item" style="display: flex;"><span class="footnote-num" style="display: inline; width: 10%; background: none; font-size: 80%; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;">[5] </span><p style="padding-top: 8px; padding-bottom: 8px; margin-bottom: 27px; display: inline; font-size: 14px; width: 90%; padding: 0px; margin: 0; line-height: 26px; word-break: break-all; width: calc(100%-50); color: #1d51ce;">DeepFlow Demo: <em style="font-style: italic; color: #888888;">https://deepflow.yunshan.net/docs/zh/install/overview/</em></p> </span> </section> </section>