[zh] sync observability/logs/* zipkin (#13697)

Signed-off-by: xin.li <xin.li@daocloud.io>
This commit is contained in:
my-git9 2023-08-06 21:50:03 +08:00 committed by GitHub
parent f445e4ad67
commit dd320bab83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 46 deletions

View File

@ -9,7 +9,8 @@ owner: istio/wg-policies-and-telemetry-maintainers
test: yes
---
通过本任务,您将了解如何使应用程序可被 [Zipkin](https://zipkin.io/) 追踪,而无需考虑应用程序使用何种开发语言、框架或平台。
通过本任务,您将了解如何使应用程序可被 [Zipkin](https://zipkin.io/) 追踪,
而无需考虑应用程序使用何种开发语言、框架或平台。
本任务使用 [Bookinfo](/zh/docs/examples/bookinfo/) 作为示例应用程序。
@ -20,14 +21,15 @@ test: yes
1. 参考 [Zipkin 安装](/zh/docs/setup/install/istioctl)文档将 Zipkin 安装到您的集群中。
1. 启用追踪时,您可以设置 Istio 用于追踪的 Sampling Rate。
安装时使用 `meshConfig.defaultConfig.tracing.sampling` [设置 Sampling Rate](/zh/docs/tasks/observability/distributed-tracing/configurability/#customizing-trace-sampling)。
安装时使用 `meshConfig.defaultConfig.tracing.sampling`
[设置 Sampling Rate](/zh/docs/tasks/observability/distributed-tracing/configurability/#customizing-trace-sampling)
默认的 Sampling Rate 为 1%。
1. 部署 [Bookinfo](/zh/docs/examples/bookinfo/#deploying-the-application) 示例应用程序。
## 访问仪表盘 {#accessing-the-dashboard}
[远程访问遥测插件](/zh/docs/tasks/observability/gateways)详细介绍了如何通过网关配置对 Istio 插件的访问
[远程访问遥测插件](/zh/docs/tasks/observability/gateways)详细介绍了如何通过网关配置对 Istio 插件的访问
对于测试(或临时访问),您也可以使用端口转发。假设已将 Zipkin 部署到 `istio-system` 命名空间,请使用以下内容:
@ -41,7 +43,8 @@ $ istioctl dashboard zipkin
{{< boilerplate trace-generation >}}
1. 在搜索面板中,点击 “+” 号,从第一个下拉列表中选择 `serviceName`,从第二个下拉列表中选择 `productpage.default`,再点击搜索图标:
1. 在搜索面板中,点击 `+` 号,从第一个下拉列表中选择 `serviceName`
从第二个下拉列表中选择 `productpage.default`,再点击搜索图标:
{{< image link="./istio-tracing-list-zipkin.png" caption="Tracing Dashboard" >}}
@ -49,7 +52,8 @@ $ istioctl dashboard zipkin
{{< image link="./istio-tracing-details-zipkin.png" caption="Detailed Trace View" >}}
1. 追踪由一组 Span 组成,其中每个 Span 对应一个 Bookinfo Service这些服务在执行 `/productpage` 请求或 Istio 内部组件时被调用,例如:`istio-ingressgateway`。
1. 追踪由一组 Span 组成,其中每个 Span 对应一个 Bookinfo Service这些服务在执行
`/productpage` 请求或 Istio 内部组件时被调用,例如:`istio-ingressgateway`。
## 清理 {#cleanup}

View File

@ -10,7 +10,9 @@ owner: istio/wg-policies-and-telemetry-maintainers
test: yes
---
Istio 最简单的日志类型是 [Envoy 的访问日志](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage)。Envoy 代理打印访问信息到标准输出。Envoy 容器的标准输出能够通过 `kubectl logs` 命令打印出来。
Istio 最简单的日志类型是
[Envoy 的访问日志](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage)。
Envoy 代理打印访问信息到标准输出。Envoy 容器的标准输出能够通过 `kubectl logs` 命令打印出来。
{{< boilerplate before-you-begin-egress >}}
@ -18,11 +20,11 @@ Istio 最简单的日志类型是 [Envoy 的访问日志](https://www.envoyproxy
## 开启 Envoy 访问日志 {#enable-envoy-s-access-logging}
Istio 提供了几种启用访问日志的方法。建议使用遥测 API
Istio 提供了几种启用访问日志的方法,建议使用 Telemetry API。
### 使用遥测 API{#using-telemetry-API}
### 使用 Telemetry API {#using-telemetry-API}
遥测 API 可以开启或关闭访问日志:
Telemetry API 可以开启或关闭访问日志:
{{< text yaml >}}
apiVersion: telemetry.istio.io/v1alpha1
@ -40,11 +42,11 @@ spec:
类似的配置也可以应用于单独的命名空间或单独的工作负载,以在细粒度级别控制日志记录。
关于使用遥测 API 的更多信息,请参见[遥测 API 概述](/zh/docs/tasks/observability/telemetry/)。
关于使用 Telemetry API 的更多信息,请参见 [Telemetry API 概述](/zh/docs/tasks/observability/telemetry/)。
### 使用网格配置 {#using-mesh-config}
如果您使用 `IstioOperator` CR 来安装 Istio请在您的配置中添加以下字段:
如果您使用 `IstioOperator` CR 来安装 Istio请在您的配置中添加以下字段
{{< text yaml >}}
spec:
@ -52,7 +54,7 @@ spec:
accessLogFile: /dev/stdout
{{< /text >}}
否则,在原来的 `istioctl install` 命令中添加相同的设置,例如:
或者,在原来的 `istioctl install` 命令中添加相同的设置,例如:
{{< text syntax=bash snip_id=none >}}
$ istioctl install <flags-you-used-to-install-Istio> --set meshConfig.accessLogFile=/dev/stdout
@ -60,9 +62,11 @@ $ istioctl install <flags-you-used-to-install-Istio> --set meshConfig.accessLogF
您也可以通过设置 `accessLogEncoding``JSON``TEXT` 来在两种格式之间切换。
您也许希望通过设置 `accessLogFormat` 来自定义访问日志的[格式](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#format-rules)。
您也许希望通过设置 `accessLogFormat`
来自定义访问日志的[格式](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#format-rules)。
更多信息请参考[global mesh options](/zh/docs/reference/config/istio.mesh.v1alpha1/#MeshConfig)在这三个设置中:
有关所有这三个设置的更多信息,请参阅
[global mesh options](/zh/docs/reference/config/istio.mesh.v1alpha1/#MeshConfig)
* `meshConfig.accessLogFile`
* `meshConfig.accessLogEncoding`
@ -70,7 +74,7 @@ $ istioctl install <flags-you-used-to-install-Istio> --set meshConfig.accessLogF
## 默认访问日志格式 {#default-access-log-format}
如果没有指定 `accessLogFormat` Istio 将使用以下默认的访问日志格式:
如果没有指定 `accessLogFormat` Istio 将使用以下默认的访问日志格式
{{< text plain >}}
[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% %RESPONSE_CODE_DETAILS% %CONNECTION_TERMINATION_DETAILS%
@ -78,9 +82,9 @@ $ istioctl install <flags-you-used-to-install-Istio> --set meshConfig.accessLogF
\"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\" %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %REQUESTED_SERVER_NAME% %ROUTE_NAME%\n
{{< /text >}}
下表显示了一个使用默认的访问日志格式的示例,请求从 `sleep` 发送到 `httpbin`:
下表显示了一个使用默认的访问日志格式的示例,请求从 `sleep` 发送到 `httpbin`
| Log operator | access log in sleep | access log in httpbin |
| 日志运算符 | sleep 中的访问日志 | httpbin 中的访问日志 |
|--------------|---------------------|-----------------------|
| `[%START_TIME%]` | `[2020-11-25T21:26:18.409Z]` | `[2020-11-25T21:26:18.409Z]`
| `\"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\"` | `"GET /status/418 HTTP/1.1"` | `"GET /status/418 HTTP/1.1"`
@ -107,7 +111,7 @@ $ istioctl install <flags-you-used-to-install-Istio> --set meshConfig.accessLogF
## 测试访问日志 {#test-the-access-log}
1. 从 `sleep``httpbin` 发送一个请求:
1. 从 `sleep``httpbin` 发送一个请求
{{< text bash >}}
$ kubectl exec "$SOURCE_POD" -c sleep -- curl -sS -v httpbin:8000/status/418
@ -127,25 +131,28 @@ $ istioctl install <flags-you-used-to-install-Istio> --set meshConfig.accessLogF
`"""`
{{< /text >}}
1. 检查 `sleep` 的日志:
1. 检查 `sleep` 的日志
{{< text bash >}}
$ kubectl logs -l app=sleep -c istio-proxy
[2019-03-06T09:31:27.354Z] "GET /status/418 HTTP/1.1" 418 - "-" 0 135 11 10 "-" "curl/7.60.0" "d209e46f-9ed5-9b61-bbdd-43e22662702a" "httpbin:8000" "172.30.146.73:80" outbound|8000||httpbin.default.svc.cluster.local - 172.21.13.94:8000 172.30.146.82:60290 -
{{< /text >}}
1. 检查 `httpbin` 的日志:
1. 检查 `httpbin` 的日志
{{< text bash >}}
$ kubectl logs -l app=httpbin -c istio-proxy
[2019-03-06T09:31:27.360Z] "GET /status/418 HTTP/1.1" 418 - "-" 0 135 5 2 "-" "curl/7.60.0" "d209e46f-9ed5-9b61-bbdd-43e22662702a" "httpbin:8000" "127.0.0.1:80" inbound|8000|http|httpbin.default.svc.cluster.local - 172.30.146.73:80 172.30.146.82:38618 outbound_.8000_._.httpbin.default.svc.cluster.local
{{< /text >}}
请注意,与请求相对应的信息分别出现在源(`sleep`)和目标(`httpbin`)的 Istio 代理日志中。您可以在日志中看到 HTTP 动词(`GET`)、HTTP 路径(`/status/418`)、响应码(`418`) 和其他[请求相关信息](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#format-rules)。
请注意,与请求相对应的信息分别出现在源(`sleep`)和目标(`httpbin`)的 Istio
代理日志中。您可以在日志中看到 HTTP 动词(`GET`、HTTP 路径(`/status/418`)、
响应码(`418`)和其他[请求相关信息](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#format-rules)。
## 清除{#cleanup}
## 清{#cleanup}
关闭 [sleep]({{<github_tree>}}/samples/sleep) 和 [httpbin]({{<github_tree>}}/samples/httpbin) 服务:
关闭 [sleep]({{<github_tree>}}/samples/sleep) 和
[httpbin]({{<github_tree>}}/samples/httpbin) 服务:
{{< text bash >}}
$ kubectl delete -f @samples/sleep/sleep.yaml@

View File

@ -87,7 +87,7 @@ EOF
有关使用 Telemetry API 的更多信息,请参阅 [Telemetry API 概述](/zh/docs/tasks/observability/telemetry/)。
### 使用网格配置
### 使用网格配置 {#using-mesh-config}
如果您使用了 `IstioOperator` CR 来安装 Istio请将以下字段添加到您的配置
@ -178,7 +178,7 @@ $ istioctl install -f <your-istio-operator-config-file>
{{< /text >}}
请注意,与请求对应的消息分别出现在来源和目的地(即 `sleep``httpbin`)的 Istio 代理日志中。
您可以在此日志中看到 HTTP 动作 (`GET`)、HTTP 路径 (`/status/418`)、响应码 (`418`)
您可以在此日志中看到 HTTP 动作`GET`、HTTP 路径(`/status/418`)、响应码(`418`
和其他[请求相关的信息](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#format-rules)。
## 清理 {#cleanup}
@ -194,7 +194,8 @@ $ kubectl delete -f @samples/open-telemetry/otel.yaml@ -n istio-system
### 禁用 Envoy 的访问日志记录 {#disable-envoy-access-logging}
在您的 Istio 安装配置中移除 `meshConfig.extensionProviders``meshConfig.defaultProviders` 设置或设置为 `""`
在您的 Istio 安装配置中移除 `meshConfig.extensionProviders`
`meshConfig.defaultProviders` 设置或设置为 `""`
{{< tip >}}
如下例所示,将 `default` 替换为安装 Istio 时所用的配置文件名称。

View File

@ -8,7 +8,7 @@ test: yes
---
Telemetry API 如今在 Istio 中作为核心 API 已经有一段时间了。
之前用户必须在 Istio 的 `MeshConfig` 中配置遥测
之前用户必须在 Istio 的 `MeshConfig` 中配置 Telemetry
{{< boilerplate before-you-begin-egress >}}
@ -132,7 +132,7 @@ $ kubectl apply -f @samples/open-telemetry/loki/otel.yaml@ -n istio-system
EOF
{{< /text >}}
有关更多信息,请参阅[使用赋值表达式](/zh/docs/tasks/observability/metrics/customize-metrics/#use-expressions-for-values)
有关更多信息,请参阅[使用赋值表达式](/zh/docs/tasks/observability/metrics/customize-metrics/#use-expressions-for-values)
## 使用 OpenTelemetry 提供程序 {#work-with-otel-provider}