Skip to content

Commit 39fa390

Browse files
authored
docs: update zipkin plugin documentation (#13277)
1 parent c3a5aad commit 39fa390

2 files changed

Lines changed: 29 additions & 9 deletions

File tree

docs/en/latest/plugins/zipkin.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@ docker run -d --name zipkin -p 9411:9411 openzipkin/zipkin
7979

8080
Create a Route with `zipkin` and use the default span version 2. You should adjust the IP address as needed for the Zipkin HTTP endpoint, and configure the sample ratio to `1` to trace every request.
8181

82+
:::note
83+
84+
You can fetch the `admin_key` from `config.yaml` and save to an environment variable with the following command:
85+
86+
```bash
87+
admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"//g')
88+
```
89+
90+
:::
91+
8292
```shell
8393
curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
8494
-H "X-API-KEY: ${admin_key}" \
@@ -202,10 +212,10 @@ Create a Route with `zipkin`. Please adjust the IP address as needed for the Zip
202212
curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
203213
-H "X-API-KEY: ${admin_key}" \
204214
-d '{
205-
"id": "kin-tracing-route",
215+
"id": "zipkin-tracing-route",
206216
"uri": "/anything",
207217
"plugins": {
208-
"kin": {
218+
"zipkin": {
209219
"endpoint": "http://127.0.0.1:9411/api/v2/spans",
210220
"sample_ratio": 1
211221
}
@@ -237,11 +247,11 @@ Similarly, you should find more span details once you click into a trace:
237247

238248
### Using Trace Variables in Logging
239249

240-
The following example demonstrates how to configure the `kin` Plugin to set the following built-in variables, which can be used in logger Plugins or access logs:
250+
The following example demonstrates how to configure the `zipkin` Plugin to set the following built-in variables, which can be used in logger Plugins or access logs:
241251

242-
- `kin_context_traceparent`: [trace parent](https://www.w3.org/TR/trace-context/#trace-context-http-headers-format) ID
243-
- `kin_trace_id`: trace ID of the current span
244-
- `kin_span_id`: span ID of the current span
252+
- `zipkin_context_traceparent`: [trace parent](https://www.w3.org/TR/trace-context/#trace-context-http-headers-format) ID
253+
- `zipkin_trace_id`: trace ID of the current span
254+
- `zipkin_span_id`: span ID of the current span
245255

246256
Update the configuration file as below. You can customize the access log format to use the `zipkin` Plugin variables, and set `zipkin` variables in the `set_ngx_var` field.
247257

docs/zh/latest/plugins/zipkin.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@ docker run -d --name zipkin -p 9411:9411 openzipkin/zipkin
7979

8080
创建一条路由,开启 `zipkin` 插件,并使用其默认的 `span_version`,即 `2`。同时请根据需要调整 Zipkin HTTP 端点的 IP 地址,将采样比率配置为 `1` 以追踪每个请求。
8181

82+
:::note
83+
84+
你可以这样从 `config.yaml` 中获取 `admin_key` 并存入环境变量:
85+
86+
```bash
87+
admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"//g')
88+
```
89+
90+
:::
91+
8292
```shell
8393
curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
8494
-H "X-API-KEY: ${admin_key}" \
@@ -227,7 +237,7 @@ curl "http://127.0.0.1:9080/anything"
227237

228238
你应该收到一个 `HTTP/1.1 200 OK` 响应。
229239

230-
导航到 Jaeger Web UI [http://127.0.0.1:16686](http://127.0.0.1:16686),选择 APISIX 作为服务,并点击 __Find Traces__,您应该看到一个与请求对应的 trace:
240+
导航到 Jaeger Web UI [http://127.0.0.1:16686](http://127.0.0.1:16686),选择 APISIX 作为服务,并点击 __Find Traces__,你应该看到一个与请求对应的 trace:
231241

232242
![jaeger trace](https://static.api7.ai/uploads/2024/01/23/X6QdLN3l_jaeger.png)
233243

@@ -240,8 +250,8 @@ curl "http://127.0.0.1:9080/anything"
240250
以下示例演示了如何配置 `zipkin` 插件以设置以下内置变量,这些变量可以在日志插件或访问日志中使用:
241251

242252
- `zipkin_context_traceparent`: [W3C trace context](https://www.w3.org/TR/trace-context/#trace-context-http-headers-format)
243-
- `zipkin_trace_id`: 当前 span 的 trace_id
244-
- `zipkin_span_id`: 当前 span 的 span_id
253+
- `zipkin_trace_id`: 当前 span 的 trace ID
254+
- `zipkin_span_id`: 当前 span 的 span ID
245255

246256
按照以下方式更新配置文件。你可以自定义访问日志格式以使用 `zipkin` 插件变量,并在 `set_ngx_var` 字段中设置 `zipkin` 变量。
247257

0 commit comments

Comments
 (0)