Skip to content

Commit

Permalink
docs: polishing zipkin and opentelemetery plugin's docs (#6302)
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Zhu <starszcan@gmail.com>
Co-authored-by: 罗泽轩 <spacewanderlzx@gmail.com>
  • Loading branch information
3 people authored Feb 16, 2022
1 parent 84eced6 commit 1407eb9
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 34 deletions.
Binary file added docs/assets/images/plugin/jaeger-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/plugin/jaeger-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/en/latest/plugins/opentelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f1
],
"plugins": {
"opentelemetry": {
sampler": {
"name": "always_on",
"sampler": {
"name": "always_on"
}
}
},
Expand Down
12 changes: 2 additions & 10 deletions docs/en/latest/plugins/skywalking.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ plugin_attr:
- By default, SkyWalking uses H2 storage, start SkyWalking directly by
```shell
sudo docker run --name skywalking -d -p 1234:1234 -p 11800:11800 -p 12800:12800 --restart always apache/skywalking-oap-server:8.7.0-es6
sudo docker run --name skywalking -d -p 1234:1234 -p 12800:12800 --restart always apache/skywalking-oap-server:8.7.0-es6
```

- Of Course, you may want to use Elasticsearch storage instead
Expand All @@ -133,7 +133,7 @@ plugin_attr:
3. Finally, run SkyWalking OAP server:

```shell
sudo docker run --name skywalking -d -p 1234:1234 -p 11800:11800 -p 12800:12800 --restart always --link elasticsearch:elasticsearch -e SW_STORAGE=elasticsearch -e SW_STORAGE_ES_CLUSTER_NODES=elasticsearch:9200 apache/skywalking-oap-server:8.7.0-es6
sudo docker run --name skywalking -d -p 1234:1234 -p 12800:12800 --restart always --link elasticsearch:elasticsearch -e SW_STORAGE=elasticsearch -e SW_STORAGE_ES_CLUSTER_NODES=elasticsearch:9200 apache/skywalking-oap-server:8.7.0-es6
```

2. SkyWalking Web UI:
Expand Down Expand Up @@ -210,23 +210,15 @@ And then reload APISIX.
## Upstream services(Code With SpringBoot)

```java
package com.lenovo.ai.controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
* @author cyxinda
* @create 2020-05-29 14:02
* @desc skywalking test controller
**/
@RestController
public class TestController {
@RequestMapping("/uid/{count}")
public String getUidList(@PathVariable("count") String countStr, HttpServletRequest request) {
System.out.println("counter:::::-----"+countStr);
return "OK";
}
}
Expand Down
70 changes: 59 additions & 11 deletions docs/en/latest/plugins/zipkin.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ title: Zipkin
- [**Attributes**](#attributes)
- [**How To Enable**](#how-to-enable)
- [**Test Plugin**](#test-plugin)
- [run the Zipkin instance](#run-the-zipkin-instance)
- [Run the Zipkin instance](#run-the-zipkin-instance)
- [Run the Jaeger instance](#run-the-jaeger-instance)
- [**Disable Plugin**](#disable-plugin)

## Name

[Zipkin](https://github.com/openzipkin/zipkin) is a OpenTracing plugin.
[Zipkin](https://github.com/openzipkin/zipkin) an open source distributed tracing system. This plugin is supported to collect tracing and report to Zipkin Collector based on [Zipkin API specification](https://zipkin.io/pages/instrumenting.html).

It's also works with `Apache SkyWalking`, which is support Zipkin v1/v2 format.
It's also works with [Apache SkyWalking](https://skywalking.apache.org/docs/main/latest/en/setup/backend/zipkin-trace/#zipkin-receiver) and [Jaeger](https://www.jaegertracing.io/docs/1.31/getting-started/#migrating-from-zipkin), which are support Zipkin [v1](https://zipkin.io/zipkin-api/zipkin-api.yaml)/[v2](https://zipkin.io/zipkin-api/zipkin2-api.yaml) format. And of course, it can integrate other tracing systems adapted to Zipkin v1/v2 format as well.

## Attributes

Expand Down Expand Up @@ -100,31 +101,78 @@ You also can complete the above operation through the web interface, first add a

## Test Plugin

### run the Zipkin instance
### Run the Zipkin instance

e.g. using docker:

```
sudo docker run -d -p 9411:9411 openzipkin/zipkin
docker run -d -p 9411:9411 openzipkin/zipkin
```

Here is a test example:

```shell
$ curl http://127.0.0.1:9080/index.html
curl http://127.0.0.1:9080/index.html
HTTP/1.1 200 OK
...
```

Then you can use a browser to access the webUI of Zipkin:
Then you can use a browser to access `http://127.0.0.1:9411/zipkin`, the webUI of Zipkin:

![zipkin web-ui](../../../assets/images/plugin/zipkin-1.jpg)

![zipkin web-ui list view](../../../assets/images/plugin/zipkin-2.jpg)

### Run the Jaeger instance

Besides Zipkin, this plugin supports reporting the traces to Jaeger as well. Here is a sample run on docker.
Run Jaeger backend on docker first:

```
http://127.0.0.1:9411/zipkin
docker run -d --name jaeger \
-e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
-p 16686:16686 \
-p 9411:9411 \
jaegertracing/all-in-one:1.31
```

![zipkin web-ui](../../../assets/images/plugin/zipkin-1.jpg)
Create a route with Zipkin plugin like Zipkin's example:

![zipkin web-ui list view](../../../assets/images/plugin/zipkin-2.jpg)
```
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"methods": ["GET"],
"uri": "/index.html",
"plugins": {
"zipkin": {
"endpoint": "http://127.0.0.1:9411/api/v2/spans",
"sample_ratio": 1,
"service_name": "APISIX-IN-SG",
"server_addr": "192.168.3.50"
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}
}'
```

Access the service:

```shell
curl http://127.0.0.1:9080/index.html
HTTP/1.1 200 OK
...
```

Then you can access `http://127.0.0.1:16686`, the WebUI of Jaeger, to view traceson browser:

![jaeger web-ui](../../../assets/images/plugin/jaeger-1.png)

![jaeger web-ui trace](../../../assets/images/plugin/jaeger-2.png)

## Disable Plugin

Expand All @@ -133,7 +181,7 @@ When you want to disable the zipkin plugin, it is very simple,
no need to restart the service, it will take effect immediately:

```shell
$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"methods": ["GET"],
"uri": "/index.html",
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/latest/plugins/opentelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f1
],
"plugins": {
"opentelemetry": {
sampler": {
"name": "always_on",
"sampler": {
"name": "always_on"
}
}
},
Expand Down
65 changes: 56 additions & 9 deletions docs/zh/latest/plugins/zipkin.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ title: zipkin

## 名字

`zipkin`(https://github.com/openzipkin/zipkin) 是一个开源的服务跟踪插件
[Zipkin](https://github.com/openzipkin/zipkin) 是开源的分布调用链追踪系统。该插件基于[Zipkin API规范](https://zipkin.io/pages/instrumenting.html),支持收集跟踪信息,并上报 Zipkin Collector

它还可以在 “Apache SkyWalking” 上运行,支持 Zipkin v1/v2 格式
> 它还能够与适配了 Zipkin [v1](https://zipkin.io/zipkin-api/zipkin-api.yaml)/[v2](https://zipkin.io/zipkin-api/zipkin2-api.yaml)[Apache SkyWalking](https://skywalking.apache.org/docs/main/latest/en/setup/backend/zipkin-trace/#zipkin-receiver)[Jaeger](https://www.jaegertracing.io/docs/1.31/getting-started/#migrating-from-zipkin)。当然,它也能够与其它支持 Zipkin v1/v2 数据格式的调用链追踪系统集成
## 属性

Expand Down Expand Up @@ -104,33 +104,80 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f1
e.g. 用 docker:

```
sudo docker run -d -p 9411:9411 openzipkin/zipkin
docker run -d -p 9411:9411 openzipkin/zipkin
```

测试示例:

```shell
$ curl http://127.0.0.1:9080/index.html
curl http://127.0.0.1:9080/index.html
HTTP/1.1 200 OK
...
```

打开浏览器,访问 Zipkin 的 web 页面:
在浏览器访问`http://127.0.0.1:9411/zipkin`,在 Zipkin WebUI 上查询 traces:

![zipkin web-ui](../../../assets/images/plugin/zipkin-1.jpg)

![zipkin web-ui list view](../../../assets/images/plugin/zipkin-2.jpg)

### Run the Jaeger instance

除了对接 Zipkin,该插件也支持将 traces 上报到 Jaeger。下面运行在`docker`环境上的示例:
首先,运行 Jaeger 后端服务:

```
http://127.0.0.1:9411/zipkin
docker run -d --name jaeger \
-e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
-p 16686:16686 \
-p 9411:9411 \
jaegertracing/all-in-one:1.31
```

![zipkin web-ui](../../../assets/images/plugin/zipkin-1.jpg)
创建路由,并且配置 Zipkin:

![zipkin web-ui list view](../../../assets/images/plugin/zipkin-2.jpg)
```
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"methods": ["GET"],
"uri": "/index.html",
"plugins": {
"zipkin": {
"endpoint": "http://127.0.0.1:9411/api/v2/spans",
"sample_ratio": 1,
"service_name": "APISIX-IN-SG",
"server_addr": "192.168.3.50"
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}
}'
```

访问服务:

```shell
curl http://127.0.0.1:9080/index.html
HTTP/1.1 200 OK
...
```

然后在浏览器中打开`http://127.0.0.1:16686`,在 Jaeger WebUI 上查询 traces:

![jaeger web-ui](../../../assets/images/plugin/jaeger-1.png)

![jaeger web-ui trace](../../../assets/images/plugin/jaeger-2.png)

## 禁用插件

当你想去掉插件的时候,很简单,在插件的配置中把对应的 json 配置删除即可,无须重启服务,即刻生效:

```shell
$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"methods": ["GET"],
"uri": "/index.html",
Expand Down

0 comments on commit 1407eb9

Please sign in to comment.