You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/01/06 06:07:46 UTC

[incubator-shenyu-website] branch main updated: add zipkin plugin doc for shenyu-agent. (#428)

This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu-website.git


The following commit(s) were added to refs/heads/main by this push:
     new 3a3a75b  add zipkin plugin doc for shenyu-agent. (#428)
3a3a75b is described below

commit 3a3a75b153e804f515a40785ee799bec46dcbbfd
Author: midnight2104 <33...@qq.com>
AuthorDate: Thu Jan 6 14:07:41 2022 +0800

    add zipkin plugin doc for shenyu-agent. (#428)
    
    * add zipkin plugin doc for shenyu-agent.
    
    * fix md lint
    
    * modify doc by review
---
 docs/user-guide/observability/tracing.md           |  52 +++++++++++++++-
 .../current/user-guide/observability/tracing.md    |  67 +++++++++++++++++++--
 .../agent/shenyu-agent-plugin-tracing-zipkin.png   | Bin 0 -> 150663 bytes
 3 files changed, 112 insertions(+), 7 deletions(-)

diff --git a/docs/user-guide/observability/tracing.md b/docs/user-guide/observability/tracing.md
index 81c6e54..4f43c99 100644
--- a/docs/user-guide/observability/tracing.md
+++ b/docs/user-guide/observability/tracing.md
@@ -74,4 +74,54 @@ plugins:
 
 The SDK used by the opentelemetry plugin is initialized based on `opentelemetry-sdk-extension-autoconfigure`. For more usage, please refer to [OpenTelemetry SDK AutoConfiguration Instructions](https://github.com/open-telemetry/opentelemetry-java/tree/v1.9.1/sdk-extensions/autoconfigure#opentelemetry-sdk-autoconfigure)
 
-#### zipkin
+
+##### zipkin
+
+| Name                 |  Type  | Default       | Description                     |
+| :------------------- | :----: | :----------- | :----------------------- |
+| SERVICE_NAME         | String | shenyu-agent | The name displayed in the traces system |
+| URL_VERSION         | String | /api/v2/spans | zipkin url version |
+| SAMPLER_TYPE  | String | const        | zipkin sampler type        |
+| SAMPLER_PARAM | String | 1            | zipkin sampler param      |
+
+
+## Agent Plugin Tracing Zipkin
+
+- modify yaml file
+
+Specify the use of the `zipkin` plugin via `supports.tracing` in the `shenyu-agent.yaml` file, and fill in the `zipkin` configuration information via `plugins.tracing`.
+
+```yaml
+appName: shenyu-agent
+supports:
+  tracing:
+    - zipkin
+
+plugins:
+  tracing:
+    zipkin:
+      host: "localhost"
+      port: 9411
+      props:
+        SERVICE_NAME: "shenyu-agent"
+        URL_VERSION: "/api/v2/spans"
+        SAMPLER_TYPE: "const"
+        SAMPLER_PARAM: "1"
+```
+
+- start zipkin-server
+
+please see [zipkin-quickstart](https://zipkin.io/pages/quickstart) to start `zipkin-server` .
+
+- tracing test 
+    - Reference [Deployment](../../deployment/deployment-local.md) to start `shenyu-admin`.
+    - Start the gateway by referring to the above procedure.
+    - Refer to [Quick start with Http](../../quick-start/quick-start-http.md) to start `shenyu-examples-http`.
+    - Launch a request to the gateway.
+    > GET http://localhost:9195/http/order/findById?id=999
+    >
+    > Accept: application/json
+
+    - After a successful request, you can see that the link log has been reported to zipkin:
+      ![](/img/shenyu/agent/shenyu-agent-plugin-tracing-zipkin.png)
+    
diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/observability/tracing.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/observability/tracing.md
index 05de6d6..024b91d 100644
--- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/observability/tracing.md
+++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/observability/tracing.md
@@ -6,7 +6,7 @@ description: Tracing access
 
 此篇文章是介绍如何使用 `Apache ShenYu Agent`中的tracing功能。
 
-## 目录结构。
+## 目录结构
 
 ```text
 .
@@ -22,7 +22,9 @@ description: Tracing access
 └── shenyu-agent.jar
 ```
 
-## 编辑配置文件(shenyu-agent.yaml)
+## 配置文件
+
+配置文件 `shenyu-agent.yaml` 位于 `shenyu-agent-dist` 模块中:
 
 ```yaml
 appName: shenyu-agent
@@ -42,9 +44,13 @@ plugins:
         JAEGER_SAMPLER_TYPE: "const"
         JAEGER_SAMPLER_PARAM: "1"
     zipkin:
-      host: 
-      port: 
+      host: "localhost"
+      port: 9411
       props:
+        SERVICE_NAME: "shenyu-agent"
+        URL_VERSION: "/api/v2/spans"
+        SAMPLER_TYPE: "const"
+        SAMPLER_PARAM: "1"
     opentelemetry:
       props:
         otel.traces.exporter: jaeger #zipkin #otlp
@@ -52,7 +58,7 @@ plugins:
         otel.exporter.jaeger.endpoint: "http://localhost:14250/api/traces"
 ```
 
-- 在 supports 中选择要使用的插件,如果不需要则去除
+- 在 supports 中选择要使用的插件,如果不需要则去除。
 - 在 plugins 中配置插件的参数,其中各插件props参数的具体使用见下面几个表格:
 
 ##### jaeger
@@ -72,4 +78,53 @@ plugins:
 
 opentelemetry 插件使用的sdk基于 `opentelemetry-sdk-extension-autoconfigure` 初始化,更多使用请参考 [OpenTelemetry SDK自动配置说明](https://github.com/open-telemetry/opentelemetry-java/tree/v1.9.1/sdk-extensions/autoconfigure#opentelemetry-sdk-autoconfigure)
 
-##### Zipkin
+##### zipkin
+
+| 名称                 |  类型  | 默认值       | 说明                     |
+| :------------------- | :----: | :----------- | :----------------------- |
+| SERVICE_NAME         | String | shenyu-agent | 在traces系统中显示的名称 |
+| URL_VERSION         | String | /api/v2/spans | Zipkin的版本 |
+| SAMPLER_TYPE  | String | const        | Zipkin 采样率类型        |
+| SAMPLER_PARAM | String | 1            | Zipkin 采样率参数        |
+
+
+## 使用 zipkin 插件
+
+- 修改配置文件
+
+在 `shenyu-agent.yaml` 文件中通过`supports.tracing`指定使用 `zipkin` 插件,通过 `plugins.tracing` 填写 `zipkin` 的配置信息。
+
+```yaml
+appName: shenyu-agent
+supports:
+  tracing:
+    - zipkin
+
+plugins:
+  tracing:
+    zipkin:
+      host: "localhost"
+      port: 9411
+      props:
+        SERVICE_NAME: "shenyu-agent"
+        URL_VERSION: "/api/v2/spans"
+        SAMPLER_TYPE: "const"
+        SAMPLER_PARAM: "1"
+```
+
+- 启动 zipkin-server
+
+请参考 [zipkin-quickstart](https://zipkin.io/pages/quickstart) 启动 `zipkin-server` 。
+
+- 测试
+   - 参考 [运维部署](../../deployment/deployment-local.md) 的相关文章,启动 `shenyu-admin`;
+   - 参考上述操作步骤,启动网关;
+   - 参考 [Http快速开始](../../quick-start/quick-start-http.md) ,启动 `shenyu-examples-http`。
+   - 向网关发起请求:
+   > GET http://localhost:9195/http/order/findById?id=999
+   >
+   > Accept: application/json
+
+   - 请求成功后,可以看到链路日志已经上报到zipkin中:
+   ![](/img/shenyu/agent/shenyu-agent-plugin-tracing-zipkin.png)
+    
\ No newline at end of file
diff --git a/static/img/shenyu/agent/shenyu-agent-plugin-tracing-zipkin.png b/static/img/shenyu/agent/shenyu-agent-plugin-tracing-zipkin.png
new file mode 100644
index 0000000..183c44e
Binary files /dev/null and b/static/img/shenyu/agent/shenyu-agent-plugin-tracing-zipkin.png differ