diff --git a/content/zh/docs/concepts/observability/index.md b/content/zh/docs/concepts/observability/index.md index 1ba824f72d..d18844a64d 100644 --- a/content/zh/docs/concepts/observability/index.md +++ b/content/zh/docs/concepts/observability/index.md @@ -131,10 +131,10 @@ Istio 支持通过 Envoy 代理进行分布式追踪。代理自动为其应用 只需要应用程序转发适当的请求上下文即可。 Istio 支持很多追踪系统,包括 [Zipkin](/zh/docs/tasks/observability/distributed-tracing/zipkin/)、 -[Jaeger](/zh/docs/tasks/observability/distributed-tracing/jaeger/)、 -[LightStep](/zh/docs/tasks/observability/distributed-tracing/lightstep/)、 -[Datadog](https://www.datadoghq.com/blog/monitor-istio-with-datadog/)。 -运维人员控制生成追踪的采样率(每个请求生成跟踪数据的速率)。这允许运维人员控制网格生成追踪数据的数量和速率。 +[Jaeger](/zh/docs/tasks/observability/distributed-tracing/jaeger/), +以及许多支持 [OpenTelemetry](/zh/docs/tasks/observability/distributed-tracing/opentelemetry/) 的工具和服务。 +操作员控制链路生成的采样率(即每个请求生成链路数据的速率)。 +这允许操作员控制为其网格生成的链路追踪数据的数量和速率。 更多关于 Istio 分布式追踪的信息可以在[分布式追踪 FAQ](/zh/about/faq/distributed-tracing/) 中找到。 diff --git a/content/zh/docs/ops/integrations/jaeger/index.md b/content/zh/docs/ops/integrations/jaeger/index.md index 6ec09c2e7e..a6f6445318 100644 --- a/content/zh/docs/ops/integrations/jaeger/index.md +++ b/content/zh/docs/ops/integrations/jaeger/index.md @@ -27,11 +27,7 @@ $ kubectl apply -f {{< github_file >}}/samples/addons/jaeger.yaml 参考 [Jaeger 文档](https://www.jaegertracing.io/)开始使用。 Jaeger 与 Istio 一起使用时无需特殊的配置。 -安装 Jaeger 完毕后,需要指定 Istio 代理向 Deployment 发送流量。 -在安装时,可以使用 `--set meshConfig.defaultConfig.tracing.zipkin.address=:9411` -进行配置。参考更多 [`ProxyConfig.Tracing`](/zh/docs/reference/config/istio.mesh.v1alpha1/#Tracing) -高级配置,如 TLS 设置。 - ## 使用 {#usage} -有关使用 Jaeger 的更多信息,请参考 [Jaeger Task](/zh/docs/tasks/observability/distributed-tracing/jaeger/)。 +有关使用 Jaeger 的信息,请参阅 +[Jaeger Task](/zh/docs/tasks/observability/distributed-tracing/jaeger/)。 diff --git a/content/zh/docs/ops/integrations/skywalking/index.md b/content/zh/docs/ops/integrations/skywalking/index.md index 86257dd73f..07cb8fc66b 100644 --- a/content/zh/docs/ops/integrations/skywalking/index.md +++ b/content/zh/docs/ops/integrations/skywalking/index.md @@ -55,5 +55,5 @@ spec: ## 使用 {#usage} -有关使用 SkyWalking 的更多信息,请参阅 +有关使用 SkyWalking 的信息,请参阅 [SkyWalking 任务](/zh/docs/tasks/observability/distributed-tracing/skywalking/)。 diff --git a/content/zh/docs/ops/integrations/zipkin/index.md b/content/zh/docs/ops/integrations/zipkin/index.md index bd60479dbd..30a62ea7b2 100644 --- a/content/zh/docs/ops/integrations/zipkin/index.md +++ b/content/zh/docs/ops/integrations/zipkin/index.md @@ -27,11 +27,7 @@ $ kubectl apply -f {{< github_file >}}/samples/addons/extras/zipkin.yaml 参阅 [Zipkin 文档](https://zipkin.io/)开始安装。Zipkin 集成 Istio 使用时无需进行特殊修改。 -Zipkin 安装完成后,您需要指定 Istio 代理用来向 Deployment 发送追踪数据。 -可以在安装时通过指定参数 `--set values.global.tracer.zipkin.address=:9411` -进行配置。更高级配置例如:TLS 配置可以参考 -[`ProxyConfig.Tracing`](/zh/docs/reference/config/istio.mesh.v1alpha1/#Tracing) 链接。 - ## 使用 {#usage} -有关使用 Zipkin 的更多信息,请参阅 [Zipkin](/zh/docs/tasks/observability/distributed-tracing/zipkin/)。 +有关使用 Zipkin 的信息,请参阅 +[Zipkin](/zh/docs/tasks/observability/distributed-tracing/zipkin/)。 diff --git a/content/zh/docs/tasks/observability/distributed-tracing/jaeger/index.md b/content/zh/docs/tasks/observability/distributed-tracing/jaeger/index.md index f2c131f8d9..610cf1f68f 100644 --- a/content/zh/docs/tasks/observability/distributed-tracing/jaeger/index.md +++ b/content/zh/docs/tasks/observability/distributed-tracing/jaeger/index.md @@ -1,7 +1,7 @@ --- title: Jaeger description: 了解如何配置代理以向 Jaeger 发送追踪请求。 -weight: 10 +weight: 6 keywords: [telemetry,tracing,jaeger,span,port-forwarding] aliases: - /zh/docs/tasks/telemetry/distributed-tracing/jaeger/ @@ -16,22 +16,58 @@ test: yes 要了解 Istio 如何处理追踪,请查看这个任务的[概述](../overview/)。 -## 开始之前{#before-you-begin} +## 开始之前 {#before-you-begin} 1. 根据 [Jaeger 安装](/zh/docs/ops/integrations/jaeger/#installation )文档将 Jaeger 安装到您的集群中。 -1. 启用追踪时,您可以设置 Istio 用于追踪的 Sampling Rate。 - 安装时使用 `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} +## 配置 Istio 进行分布式链路追踪 {#configure-istio-for-distributed-tracing} -[远程访问遥测插件](/zh/docs/tasks/observability/gateways)详细介绍了如何通过网关配置对 -Istio 插件的访问。 +### 配置扩展提供程序 {#configure-an-extension-provider} + +使用引用 Jaeger 收集器服务的[扩展提供程序](/zh/docs/reference/config/istio.mesh.v1alpha1/#MeshConfig-ExtensionProvider)安装 Istio: + +{{< text bash >}} +$ cat < ./tracing.yaml +apiVersion: install.istio.io/v1alpha1 +kind: IstioOperator +spec: + meshConfig: + enableTracing: true + defaultConfig: + tracing: {} # 禁用旧版 MeshConfig 链路追踪选项 + extensionProviders: + - name: jaeger + opentelemetry: + port: 4317 + service: jaeger-collector.istio-system.svc.cluster.local +EOF +$ istioctl install -f ./tracing.yaml --skip-confirmation +{{< /text >}} + +### 开启链路追踪 {#enable-tracing} + +通过应用以下配置启用链路追踪: + +{{< text bash >}} +$ kubectl apply -f - <}} + +## 访问仪表盘 {#accessing-the-dashboard} + +[远程访问遥测插件任务](/zh/docs/tasks/observability/gateways)详细说明了如何通过网关配置对 Istio 插件的访问。 对于测试(或临时访问),您也可以使用端口转发。假设已将 Jaeger 部署到 `istio-system` 命名空间,请使用以下内容: diff --git a/content/zh/docs/tasks/observability/distributed-tracing/mesh-and-proxy-config/index.md b/content/zh/docs/tasks/observability/distributed-tracing/mesh-and-proxy-config/index.md index 080f843096..8b5824687f 100644 --- a/content/zh/docs/tasks/observability/distributed-tracing/mesh-and-proxy-config/index.md +++ b/content/zh/docs/tasks/observability/distributed-tracing/mesh-and-proxy-config/index.md @@ -1,7 +1,7 @@ --- title: 使用 MeshConfig 和 Pod 注解配置链路追踪 description: 如何使用 MeshConfig 和 Pod 注解配置链路追踪。 -weight: 11 +weight: 3 keywords: [telemetry,tracing] aliases: - /zh/docs/tasks/observability/distributed-tracing/configurability/ @@ -11,19 +11,16 @@ test: no status: Beta --- -{{< tip >}} -鼓励用户使用 [Telemetry API](/zh/docs/tasks/observability/telemetry/) 配置链路追踪。 -{{}} +{{< boilerplate telemetry-tracing-tips >}} Istio 提供了配置高级链路追踪选项的能力,例如采样率和向报告的 span 中添加自定义标签。 -采样是一个 Beta 级别特性,但是添加自定义标签和追踪的标签长度会考虑在本版本中开发。 ## 开始之前 {#before-you-begin} 1. 确保您的应用程序按照[此处](/zh/docs/tasks/observability/distributed-tracing/overview/)所述传输链路追踪的标头。 -1. 遵循位于[集成](/zh/docs/ops/integrations/)章节下关于链路追踪的安装指南, - 根据您喜欢的追踪后端安装适当的插件并且配置您的 Istio 代理以将追踪信息发送到部署的追踪后端中。 +1. 按照位于[集成](/zh/docs/ops/integrations/)下的链路追踪安装指南, + 根据您首选的链路追踪后端安装适当的软件并配置您的 Istio 代理以将链路发送到链路追踪部署。 ## 可用的链路追踪配置 {#available-tracing-configurations} @@ -39,15 +36,13 @@ Istio 提供了配置高级链路追踪选项的能力,例如采样率和向 有两种方法可以配置链路追踪选项: -1. 全局通过 `MeshConfig` 选项。 +1. 全局地,通过 `MeshConfig` 选项。 -1. 用于工作负载特定定制的每个 Pod 注解。 +1. 基于每个 Pod 的注释,用于特定工作负载的定制。 {{< warning >}} 为了使新的链路追踪配置对其中任何一个 Pod 生效,您需要重新启动注入 Istio 代理的 Pod。 -{{< /warning >}} -{{< warning >}} 为链路追踪配置而添加的任何 Pod 注解都会覆盖全局设置。为了保留全局设置, 您应该将它们从全局网格配置复制到 Pod 注解中,并进行特定于工作负载的定制。 特别是要确保注解中始终提供链路追踪后端的地址,以确保正确地报告工作负载的追踪信息。 @@ -130,7 +125,9 @@ spec: ... {{< /text >}} -## 自定义链路追踪采样 {#customizing-trace-sampling} +## 自定义 {#customization} + +### 自定义链路追踪采样 {#customizing-trace-sampling} 采样率选项可用于控制向链路追踪系统报告的请求的百分比, 这应该根据网格中的通信量和想要收集的追踪数据量进行配置, @@ -159,7 +156,7 @@ spec: 采样率应在 0.0 到 100.0 的范围内,精度为 0.01。 例如,要最终每 10000 个请求中的 5 个,使用 0.05 作为这里的值。 -## 定制追踪标签 {#customizing-tracing-tags} +### 定制追踪标签 {#customizing-tracing-tags} 可以根据文字、环境变量和客户端请求标头向 span 中添加自定义标签, 以便在 span 中提供特定于您的环境的额外信息。 @@ -225,7 +222,7 @@ spec: defaultValue: # 可选 {{< /text >}} -## 自定义链路追踪标签长度 {#customizing-tracing-tag-length} +### 自定义链路追踪标签长度 {#customizing-tracing-tag-length} 默认情况下,`HttpUrl` span 标签中包含的请求路径的最大长度是 256。 要修改此最大长度,请将以下内容添加到您的 `tracing.yaml` 文件。 diff --git a/content/zh/docs/tasks/observability/distributed-tracing/opentelemetry/index.md b/content/zh/docs/tasks/observability/distributed-tracing/opentelemetry/index.md index a994213ad7..7eee095fc4 100644 --- a/content/zh/docs/tasks/observability/distributed-tracing/opentelemetry/index.md +++ b/content/zh/docs/tasks/observability/distributed-tracing/opentelemetry/index.md @@ -1,21 +1,31 @@ --- title: OpenTelemetry -description: 了解如何配置代理将 OpenTelemetry 链路发送至 Collector。 -weight: 10 +description: 了解如何配置代理以 OpenTelemetry 格式发送链路。 +weight: 5 keywords: [telemetry,tracing,opentelemetry,span,port-forwarding] aliases: - /zh/docs/tasks/telemetry/distributed-tracing/opentelemetry/ + - /zh/docs/tasks/observability/distributed-tracing/lightstep/ + - /zh/latest/docs/tasks/observability/distributed-tracing/lightstep/ owner: istio/wg-policies-and-telemetry-maintainers test: yes --- +[OpenTelemetry](https://opentelemetry.io/) (OTel) 是一个与供应商无关的开源可观测性框架, +用于检测、生成、收集和导出遥测数据。 +[OpenTelemetry 协议](https://opentelemetry.io/docs/specs/otlp/) (OTLP) 链路可以发送到 +[Jaeger](/zh/docs/tasks/observability/distributed-tracing/jaeger/) 以及许多商业服务。 + +要了解 Istio 如何处理链路追踪,请访问此任务的[概述](../overview/)。 + 完成此任务后,无论您使用什么语言、框架或平台来构建应用程序, 您都将了解如何让您的应用程序接入 [OpenTelemetry](https://www.opentelemetry.io/) 的链路追踪。 -此任务使用 [Bookinfo](/zh/docs/examples/bookinfo/) -作为示例应用程序,并使用 -[OpenTelemetry Collector](https://opentelemetry.io/docs/collector/) 作为链路接收器。 +此任务使用 [Bookinfo](/zh/docs/examples/bookinfo/) 示例作为示例应用程序, +并使用 [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/) 作为链路接收器。 +要查看如何将链路直接发送到 OTLP 兼容后端的示例, +请参阅 [Jaeger 任务](/zh/docs/tasks/observability/distributed-tracing/jaeger/)。 要了解 Istio 如何处理链路追踪,请访问此任务的[概述](../overview/)。 diff --git a/content/zh/docs/tasks/observability/distributed-tracing/overview/index.md b/content/zh/docs/tasks/observability/distributed-tracing/overview/index.md index b4b50b5e02..7169c62475 100644 --- a/content/zh/docs/tasks/observability/distributed-tracing/overview/index.md +++ b/content/zh/docs/tasks/observability/distributed-tracing/overview/index.md @@ -12,14 +12,25 @@ test: n/a 分布式链路追踪可以让用户对跨多个分布式服务网格的 1 个请求进行追踪分析。 进而可以通过可视化的方式更加深入地了解请求的延迟、序列化和并行度。 -Istio 利用 [Envoy 的分布式追踪](https://www.envoyproxy.io/docs/envoy/v1.12.0/intro/arch_overview/observability/tracing)功能提供了开箱即用的链路追踪集成。 -确切地说,Istio 提供了安装各种链路追踪后端服务的选项,并且通过配置代理来自动发送链路追踪 span 到分布式追踪系统服务。 -请参阅 [Zipkin](/zh/docs/tasks/observability/distributed-tracing/zipkin/)、 -[Jaeger](/zh/docs/tasks/observability/distributed-tracing/jaeger/) 和 -[Lightstep](/zh/docs/tasks/observability/distributed-tracing/lightstep/) -的任务文档来了解 Istio 如何与这些分布式链路追踪系统协作。 +Istio 利用 [Envoy 的分布式链路追踪](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/observability/tracing)功能提供开箱即用的链路追踪集成。 -## 追踪上下文传递 {#trace-context-propagation} +现在,大多数链路追踪后端都接受 +[OpenTelemetry](/zh/docs/tasks/observability/distributed-tracing/opentelemetry/) 协议来接收链路, +但 Istio 还支持 [Zipkin](/zh/docs/tasks/observability/distributed-tracing/zipkin/) +和 [Apache SkyWalking](/zh/docs/tasks/observability/distributed-tracing/skywalking/) 等项目的传统协议。 + +## 配置链路追踪 {#configuring-tracing} + +Istio 提供了 [Telemetry API](/zh/docs/tasks/observability/distributed-tracing/telemetry-api/), +可用于配置分布式链路追踪,包括选择提供商、 +设置[采样率](/zh/docs/tasks/observability/distributed-tracing/sampling/)和修改标头。 + +## 扩展提供程序 {#extension-providers} + +[扩展提供程序](/zh/docs/reference/config/istio.mesh.v1alpha1/#MeshConfig-ExtensionProvider)在 `MeshConfig` 中定义, +并允许定义链路追踪后端的配置。支持的提供程序包括 OpenTelemetry、Zipkin、SkyWalking、Datadog 和 Stackdriver。 + +## 构建应用程序以支持链路上下文传播 {#building-applications-to-support-trace-context-propagation} 尽管 Istio 代理能够自动发送 span,但需要一些附加信息才能将这些 span 加到同一个调用链。 所以当代理发送 span 信息的时候,应用程序需要附加适当的 HTTP 请求头信息,这样才能够把多个 @@ -31,9 +42,10 @@ span 加到同一个调用链。 所有应用程序必须转发以下请求头: -* `x-request-id`:这是 Envoy 专用的请求头,用于对日志和追踪进行一致的采样。 +* `x-request-id`:一个 Envoy 特定的标头,用于一致地采样日志和链路。 +* `traceparent` 和 `tracestate`:[W3C 标准标头](https://www.w3.org/TR/trace-context/) -对于 Zipkin、Jaeger 和 Stackdriver,应转发 B3 多请求头格式: +对于 Zipkin,应转发 [B3 多标头格式](https://github.com/openzipkin/b3-propagation): * `x-b3-traceid` * `x-b3-spanid` @@ -41,41 +53,18 @@ span 加到同一个调用链。 * `x-b3-sampled` * `x-b3-flags` -这些是 Zipkin、Jaeger 和其它更多工具支持的请求头。 +对于商业可观察性工具,请参阅其文档。 -对于 Datadog,应转发以下请求头,这些转发由对应语言和框架的 Datadog 客户端库自动处理。 - -* `x-datadog-trace-id` -* `x-datadog-parent-id` -* `x-datadog-sampling-priority` - -对于 Lightstep,应转发 OpenTracing span 上下文请求头: - -* `x-ot-span-context` - -对于 Stackdriver,您可以使用以下任一请求头来替代 B3 多请求头格式: - -* `grpc-trace-bin`:标准的 grpc 追踪头。 -* `traceparent`:追踪所用的 W3C 追踪上下文标准,受 OpenTelemetry - 和日益增加的 Jaeger 客户端库所支持。 -* `x-cloud-trace-context`:被 Google Cloud 产品 API 所使用。 - -例如,如果您看基于 Python 语言的 `productpage` 服务这个例子,可以看到这个应用程序使用了 -[OpenTracing](https://opentracing.io/) 库从 HTTP 请求中提取所需的请求头信息: +例如,如果你查看[示例 Python `productpage` 服务]({{< github_blob >}}/samples/bookinfo/src/productpage/productpage.py#L125), +你会看到应用程序使用 OpenTelemetry 库从 HTTP 请求中提取所有链路追踪器所需的标头: {{< text python >}} def getForwardHeaders(request): headers = {} - # 可以使用 opentracing span 填充 x-b3-*** 请求头 - span = get_current_span() - carrier = {} - tracer.inject( - span_context=span.context, - format=Format.HTTP_HEADERS, - carrier=carrier) - - headers.update(carrier) + # 可以使用 OpenTelemetry 跨度填充 x-b3-*** 标头 + ctx = propagator.extract(carrier={k.lower(): v for k, v in request.headers}) + propagator.inject(headers, ctx) # ... @@ -104,7 +93,7 @@ def getForwardHeaders(request): return headers {{< /text >}} -在 review 这个应用中(Java)使用 `requestHeaders` 做了类似的事情: +在 [reviews 应用程序]({{< github_blob >}}/samples/bookinfo/src/reviews/reviews-application/src/main/java/application/rest/LibertyRestEndpoint.java#L186) (Java) 中使用 `requestHeaders` 做了类似的事情: {{< text java >}} @GET diff --git a/content/zh/docs/tasks/observability/distributed-tracing/sampling/index.md b/content/zh/docs/tasks/observability/distributed-tracing/sampling/index.md index 06d6e1de59..6ebb25bcec 100644 --- a/content/zh/docs/tasks/observability/distributed-tracing/sampling/index.md +++ b/content/zh/docs/tasks/observability/distributed-tracing/sampling/index.md @@ -1,7 +1,7 @@ --- -title: 链路采样 +title: 配置链路采样 description: 了解有关如何在代理上配置链路采样的不同方法。 -weight: 10 +weight: 4 keywords: [sampling,telemetry,tracing,opentelemetry] owner: istio/wg-policies-and-telemetry-maintainers test: yes @@ -20,10 +20,6 @@ Istio 提供了多种配置链路采样的方法。 1. 自定义 OpenTelemetry 采样器:自定义采样器实现,必须与 `OpenTelemetryTracingProvider` 进行配对。 -1. 部署 OpenTelemetry Collector。 - - {{< boilerplate start-otel-collector-service >}} - ### 百分比采样器 {#percentage-sampler} {{< boilerplate telemetry-tracing-tips >}} @@ -35,7 +31,47 @@ Istio 提供了多种配置链路采样的方法。 您可以通过三种方式配置随机采样率: -#### 通过 `MeshConfig` 进行全局配置 {#globally-via-meshconfig} +#### Telemetry API {#telemetry-api} + +可以在各种范围内配置采样:网格范围、命名空间或工作负载,从而提供极大的灵活性。 +要了解更多信息,请参阅 [Telemetry API](/zh/docs/tasks/observability/telemetry/) 文档。 + +安装 Istio 时无需在 `defaultConfig` 中设置 `sampling`: + +{{< text syntax=bash snip_id=install_without_sampling >}} +$ cat <}} + +通过 Telemetry API 启用链路追踪提供程序并设置 `randomSamplingPercentage`: + +{{< text syntax=bash snip_id=enable_telemetry_with_sampling >}} +$ kubectl apply -f - <}} + +#### 实用 `MeshConfig` {#using-meshconfig} 随机百分比采样可以通过 `MeshConfig` 进行全局配置。 @@ -59,8 +95,8 @@ spec: EOF {{< /text >}} -然后通过 Telemetry API 启用链路追踪提供程序。 -请注意,我们在这里不对 `randomSamplingPercentage` 进行设置。 +然后,通过 Telemetry API 启用链路追踪提供程序。 +请注意,我们在这里不设置 `randomSamplingPercentage`。 {{< text syntax=bash snip_id=enable_telemetry_no_sampling >}} $ kubectl apply -f - <}} -#### `proxy.istio.io/config` Pod 注解 {#pod-annotation-proxy.istio.io/config} +#### 使用 `proxy.istio.io/config` 注解 {#using-the-proxy.istio.io/config-annotation} 您可以将 `proxy.istio.io/config` 注解添加到 Pod 元数据规范中, 以覆盖任何网格范围的采样设置。 @@ -102,66 +138,25 @@ spec: ... {{< /text >}} -#### Telemetry API {#telemetry-api} - -随机百分比采样器也可以通过 Telemetry API 进行配置。 -通过 Telemetry API,可以在各种范围内配置采样:网格范围、命名空间或工作负载,提供了极大的灵活性。 -要了解更多信息,请参阅 [Telemetry API](/zh/docs/tasks/observability/telemetry/) 文档。 - -安装 Istio,并且不在 `defaultConfig` 中设置 `sampling`: - -{{< text syntax=bash snip_id=install_without_sampling >}} -$ cat <}} - -然后通过 Telemetry API 启用链路追踪提供程序并设置 `randomSamplingPercentage`。 - -{{< text syntax=bash snip_id=enable_telemetry_with_sampling >}} -$ kubectl apply -f - <}} - ### 自定义 OpenTelemetry 采样器 {#custom-opentelemetry-sampler} -OpenTelemetry 规范定义了 [Sampler API](https://github.com/open-telemetry/opentelemetry-specation/blob/v1.31.0/specification/trace/sdk.md#sampler)。 +OpenTelemetry 规范定义了 [Sampler API](https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampler)。 Sampler API 支持构建自定义采样器,该采样器可以执行更智能、更高效的采样决策, -例如 [Probability Sampling(概率采样)](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.31.0/specification/trace/tracestate-probability-sampling.md)。 +例如 [Probability Sampling(概率采样)](https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling-experimental/)。 然后,此类采样器可以与 [`OpenTelemetryTracingProvider`](/zh/docs/reference/config/istio.mesh.v1alpha1/#MeshConfig-ExtensionProvider-OpenTelemetryTracingProvider) 配对。 {{< quote >}} 驻留在代理中的采样器实现, -可以在 [Envoy OpenTelemetry Samplers](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/trace/opentelemetry/samplers#opentelemetry-samplers) 中找到 。 +可以在 [Envoy OpenTelemetry Samplers](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/trace/opentelemetry/samplers#opentelemetry-samplers) 中找到。 {{< /quote >}} 当前在 Istio 中的自定义采样器配置: - [Dynatrace 采样器](/zh/docs/reference/config/istio.mesh.v1alpha1/#MeshConfig-ExtensionProvider-OpenTelemetryTracingProvider-DynatraceSampler) -自定义采样器通过 `Meshconfig` 进行配置。以下是配置 Dynatrace 采样器的示例: +自定义采样器通过 `MeshConfig` 进行配置。以下是配置 Dynatrace 采样器的示例: {{< text syntax=yaml snip_id=none >}} apiVersion: install.istio.io/v1alpha1 @@ -184,24 +179,28 @@ spec: cluster_id: 123 {{< /text >}} -## 优先顺序 {#order-of-precedence} +### 优先顺序 {#order-of-precedence} 通过多种配置采样的方法,了解每种方法的优先顺序非常重要。 使用随机百分比采样器时,优先顺序为: -`Telemetry API` > `Pod 注解` > `MeshConfig`。 +
Telemetry API > Pod 注解 > MeshConfig
这意味着,如果在上述所有内容中都定义了一个值, -则 `Telemetry API` 中的值就是被选定的值。 +则 Telemetry API 中的值就是被选定的值。 配置自定义 OpenTelemetry 采样器时,优先顺序为: -`自定义 OTel 采样器` > (`Telemetry API` | `Pod 注解` | `MeshConfig`) +
自定义 OTel 采样器 > (Telemetry API | Pod 注解 | MeshConfig
-这意味着,如果配置了自定义 OpenTelemetry 采样器,它将覆盖所有其他方式。 -此外,随机百分比值被设置为 `100` 且不可更改。 -这很重要,因为自定义采样器需要接收 100% 的 Span 才能正确执行其决策。 +这意味着,如果配置了自定义 OpenTelemetry 采样器,它将覆盖所有其他方法。 +此外,随机百分比值设置为 `100` 并且无法更改。这很重要, +因为自定义采样器需要接收 100% 的 Span 才能正确执行其决策。 + +## 部署 OpenTelemetry 收集器 {#deploy-the0-opentelemetry-collector} + +{{< boilerplate start-otel-collector-service >}} ## 部署 Bookinfo 应用程序 {#deploy-the-bookinfo-application} diff --git a/content/zh/docs/tasks/observability/distributed-tracing/skywalking/index.md b/content/zh/docs/tasks/observability/distributed-tracing/skywalking/index.md index 4776aa8d8f..c835daea4c 100644 --- a/content/zh/docs/tasks/observability/distributed-tracing/skywalking/index.md +++ b/content/zh/docs/tasks/observability/distributed-tracing/skywalking/index.md @@ -1,7 +1,7 @@ --- title: Apache SkyWalking description: 学习如何配置代理将链路追踪请求发送到 Apache SkyWalking。 -weight: 10 +weight: 8 keywords: [telemetry,tracing,skywalking,span,port-forwarding] owner: istio/wg-policies-and-telemetry-maintainers test: yes @@ -16,7 +16,7 @@ test: yes ## 配置链路追踪 {#configure-tracing} -如果您使用了 `IstioOperator` CR 来安装 Istio,请将以下字段添加到您的配置: +如果您使用了 `IstioOperator` 配置来安装 Istio,请将以下字段添加到您的配置: {{< text yaml >}} apiVersion: install.istio.io/v1alpha1 @@ -64,7 +64,7 @@ SkyWalking 部署到集群中。 ## 访问仪表板 {#accessing-dashboard} -[远程访问遥测插件](/zh/docs/tasks/observability/gateways)详细说明了如何配置通过 +[远程访问遥测插件任务](/zh/docs/tasks/observability/gateways)详细说明了如何配置通过 Gateway 访问 Istio 插件。 对于测试(和临时访问),您也可以使用端口转发。 diff --git a/content/zh/docs/tasks/observability/distributed-tracing/telemetry-api/index.md b/content/zh/docs/tasks/observability/distributed-tracing/telemetry-api/index.md index ec325d43cb..191516cfc0 100644 --- a/content/zh/docs/tasks/observability/distributed-tracing/telemetry-api/index.md +++ b/content/zh/docs/tasks/observability/distributed-tracing/telemetry-api/index.md @@ -1,26 +1,30 @@ --- title: 使用 Telemetry API 配置链路追踪 description: 如何使用 Telemetry API 配置链路追踪。 -weight: 8 +weight: 2 keywords: [telemetry,tracing] owner: istio/wg-policies-and-telemetry-maintainers test: yes --- -Istio 提供了配置高级链路追踪选项的功能,例如采样率和向已采集的 span 中添加自定义标签。 -本任务将向您展示如何使用 Telemetry API 自定义链路追踪选项。 +Istio 提供了配置链路追踪选项的功能,例如采样率和向报告的 Span 添加自定义标签。 +此任务向您展示如何使用 Telemetry API 自定义链路追踪选项。 -## 开始之前 {#before-you-begin} +## 开始之前 {#before-you-begin} 1. 请确保您的应用程序按照[这里](/zh/docs/tasks/observability/distributed-tracing/overview/)所描述的方式配置链路追踪的标头。 -1. 请根据您首选的追踪后端,根据[集成](/zh/docs/ops/integrations/)追踪安装指南安装适当的插件, - 并配置您的 Istio 代理将链路追踪信息发送到链路追踪部署服务端。 +1. 根据您首选的链路追踪后端, + 按照位于[集成](/zh/docs/ops/integrations/)下的链路追踪安装指南安装适当的软件并配置扩展提供程序。 -## 安装 {#installation} +## 安装 {#installation} -在此示例中,我们将发送跟踪信息到[`链路追踪系统 zipkin`](/zh/docs/ops/integrations/zipkin/), -请确保已安装它: +在此示例中,我们将链路发送到 [Zipkin](/zh/docs/ops/integrations/zipkin/)。 +继续操作之前,请先安装 Zipkin。 + +### 配置扩展提供程序 {#configure-an-extension-provider} + +使用引用 Zipkin 服务的[扩展提供程序](/zh/docs/reference/config/istio.mesh.v1alpha1/#MeshConfig-ExtensionProvider)安装 Istio: {{< text bash >}} $ cat < ./tracing.yaml @@ -30,10 +34,10 @@ spec: meshConfig: enableTracing: true defaultConfig: - tracing: {} # 禁用 MeshConfig 链路追踪选项 + tracing: {} # 禁用旧版 MeshConfig 链路追踪选项 extensionProviders: # 添加 zipkin 提供商 - - name: zipkin + - name: "zipkin" zipkin: service: zipkin.istio-system.svc.cluster.local port: 9411 @@ -41,7 +45,7 @@ EOF $ istioctl install -f ./tracing.yaml --skip-confirmation {{< /text >}} -### 启用服务网格的链路追踪 {#enable-tracing-for-mesh} +### 启用链路追踪 {#enable-tracing} 通过以下配置启用链路追踪: @@ -54,12 +58,18 @@ metadata: namespace: istio-system spec: tracing: - - providers: - - name: "zipkin" + - providers: + - name: "zipkin" EOF {{< /text >}} -## 自定义链路追踪采样率 {#customizing-trace-sampling} +### 验证结果 {#verify-the-results} + +您可以通过[访问 Zipkin UI](/zh/docs/tasks/observability/distributed-tracing/zipkin/)来验证结果。 + +## 自定义 {#customization} + +### 自定义链路采样 {#customizing-trace-sampling} 采样率选项可用于控制向链路追踪系统报告的请求百分比, 应根据服务网格中的流量和您想要收集的链路追踪数据量来配置此选项, @@ -74,13 +84,13 @@ metadata: namespace: istio-system spec: tracing: - - providers: - - name: "zipkin" - randomSamplingPercentage: 100.00 + - providers: + - name: "zipkin" + randomSamplingPercentage: 100.00 EOF {{< /text >}} -## 自定义链路追踪标签 {#customizing-tracing-tags} +### 自定义链路追踪标签 {#customizing-tracing-tags} 可以基于文本、环境变量和客户端请求标头向 span 中添加自定义标签,以在与环境相关的 span 中提供额外的信息。 @@ -101,8 +111,8 @@ EOF namespace: istio-system spec: tracing: - - providers: - - name: "zipkin" + - providers: + - name: "zipkin" randomSamplingPercentage: 100.00 customTags: "provider": @@ -121,7 +131,7 @@ EOF spec: tracing: - providers: - - name: "zipkin" + - name: "zipkin" randomSamplingPercentage: 100.00 customTags: "cluster_id": @@ -146,7 +156,7 @@ EOF spec: tracing: - providers: - - name: "zipkin" + - name: "zipkin" randomSamplingPercentage: 100.00 customTags: my_tag_header: @@ -155,7 +165,7 @@ EOF defaultValue: # 可选 {{< /text >}} -## 自定义链路追踪标签长度 {#customizing-tracing-tag-length} +### 自定义链路追踪标签长度 {#customizing-tracing-tag-length} 默认情况下,`HttpUrl` 的 span 标签的请求最大长度为 256。要修改此最大长度, 请将以下内容添加到您的 `tracing.yaml` 配置文件中。 @@ -167,16 +177,11 @@ spec: meshConfig: enableTracing: true defaultConfig: - tracing: {} # 通过 MeshConfig 禁用链路追踪选项 + tracing: {} # 通过 MeshConfig 禁用旧版链路追踪选项 extensionProviders: - # 添加 zipkin 提供商 - - name: zipkin + - name: "zipkin" zipkin: service: zipkin.istio-system.svc.cluster.local port: 9411 maxTagLength: {{< /text >}} - -## 验证结果 {#verify-the-results} - -您可以使用 [Zipkin 界面](/zh/docs/tasks/observability/distributed-tracing/zipkin/)来验证结果。 diff --git a/content/zh/docs/tasks/observability/distributed-tracing/zipkin/index.md b/content/zh/docs/tasks/observability/distributed-tracing/zipkin/index.md index c8948624f8..a847ccdff1 100644 --- a/content/zh/docs/tasks/observability/distributed-tracing/zipkin/index.md +++ b/content/zh/docs/tasks/observability/distributed-tracing/zipkin/index.md @@ -1,7 +1,7 @@ --- title: Zipkin description: 了解如何通过配置代理以向 Zipkin 发送追踪请求。 -weight: 10 +weight: 7 keywords: [telemetry,tracing,zipkin,span,port-forwarding] aliases: - /zh/docs/tasks/zipkin-tracing.html @@ -20,16 +20,53 @@ 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), - 默认的 Sampling Rate 为 1%。 - 1. 部署 [Bookinfo](/zh/docs/examples/bookinfo/#deploying-the-application) 示例应用程序。 -## 访问仪表盘 {#accessing-the-dashboard} +## 配置 Istio 进行分布式链路追踪 {#configure-istio-for-distributed-tracing} -[远程访问遥测插件](/zh/docs/tasks/observability/gateways)详细介绍了如何通过网关配置对 Istio 插件的访问。 +### 配置扩展提供程序 {#configure-an-extension-provider} + +使用引用 Zipkin 服务的[扩展提供程序](/zh/docs/reference/config/istio.mesh.v1alpha1/#MeshConfig-ExtensionProvider)安装 Istio: + +{{< text bash >}} +$ cat < ./tracing.yaml +apiVersion: install.istio.io/v1alpha1 +kind: IstioOperator +spec: + meshConfig: + enableTracing: true + defaultConfig: + tracing: {} # 禁用旧版 MeshConfig 链路追踪选项 + extensionProviders: + - name: zipkin + zipkin: + service: zipkin.istio-system.svc.cluster.local + port: 9411 +EOF +$ istioctl install -f ./tracing.yaml --skip-confirmation +{{< /text >}} + +### 启用链路追踪 {#enable-tracing} + +通过应用以下配置启用链路追踪: + +{{< text bash >}} +$ kubectl apply -f - <}} + +## 访问仪表盘 {#accessing-the-dashboard} + +[远程访问遥测插件任务](/zh/docs/tasks/observability/gateways)详细介绍了如何通过网关配置对 Istio 插件的访问。 对于测试(或临时访问),您也可以使用端口转发。假设已将 Zipkin 部署到 `istio-system` 命名空间,请使用以下内容: diff --git a/content/zh/docs/tasks/observability/logs/access-log/index.md b/content/zh/docs/tasks/observability/logs/access-log/index.md index 389d676a93..4f0cc688d9 100644 --- a/content/zh/docs/tasks/observability/logs/access-log/index.md +++ b/content/zh/docs/tasks/observability/logs/access-log/index.md @@ -46,7 +46,7 @@ spec: ### 使用网格配置 {#using-mesh-config} -如果您使用 `IstioOperator` CR 来安装 Istio,请在您的配置中添加以下字段: +如果您使用 `IstioOperator` 配置来安装 Istio,请在您的配置中添加以下字段: {{< text yaml >}} spec: diff --git a/content/zh/docs/tasks/observability/logs/otel-provider/index.md b/content/zh/docs/tasks/observability/logs/otel-provider/index.md index 02cefa2289..0720d976f1 100644 --- a/content/zh/docs/tasks/observability/logs/otel-provider/index.md +++ b/content/zh/docs/tasks/observability/logs/otel-provider/index.md @@ -89,7 +89,7 @@ EOF ### 使用网格配置 {#using-mesh-config} -如果您使用了 `IstioOperator` CR 来安装 Istio,请将以下字段添加到您的配置: +如果您使用了 `IstioOperator` 配置来安装 Istio,请将以下字段添加到您的配置: {{< text yaml >}} spec: diff --git a/content/zh/docs/tasks/traffic-management/egress/egress-control/index.md b/content/zh/docs/tasks/traffic-management/egress/egress-control/index.md index 536e178136..77d8923ac0 100644 --- a/content/zh/docs/tasks/traffic-management/egress/egress-control/index.md +++ b/content/zh/docs/tasks/traffic-management/egress/egress-control/index.md @@ -116,7 +116,7 @@ Istio 代理允许调用未知的服务。如果这个选项设置为 `REGISTRY_ 1. 执行以下命令来将 `global.outboundTrafficPolicy.mode` 选项改为 `REGISTRY_ONLY`: - 如果您使用 `IstioOperator` CR 安装 Istio,请在配置中添加以下字段: + 如果您使用 `IstioOperator` 配置安装 Istio,请在配置中添加以下字段: {{< text yaml >}} spec: diff --git a/content/zh/docs/tasks/traffic-management/egress/egress-gateway/index.md b/content/zh/docs/tasks/traffic-management/egress/egress-gateway/index.md index 6793878162..be36891926 100644 --- a/content/zh/docs/tasks/traffic-management/egress/egress-gateway/index.md +++ b/content/zh/docs/tasks/traffic-management/egress/egress-gateway/index.md @@ -90,7 +90,7 @@ Egress 网关允许您将 Istio 的功能(例如监控和路由规则)应用 如果没有 Pod 被返回,通过接下来的步骤来部署 Istio Egress 网关。 -1. 如果您使用 `IstioOperator` CR 安装 Istio,请在配置中添加以下字段: +1. 如果您使用 `IstioOperator` 配置安装 Istio,请在配置中添加以下字段: {{< text yaml >}} spec: