<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Open Telemetry Collector on Dapr 文档库</title><link>https://v1-18.docs.dapr.io/zh-hans/operations/observability/tracing/otel-collector/</link><description>Recent content in Open Telemetry Collector on Dapr 文档库</description><generator>Hugo</generator><language>zh-hans</language><atom:link href="https://v1-18.docs.dapr.io/zh-hans/operations/observability/tracing/otel-collector/index.xml" rel="self" type="application/rss+xml"/><item><title>使用 OpenTelemetry Collector 收集追踪</title><link>https://v1-18.docs.dapr.io/zh-hans/operations/observability/tracing/otel-collector/open-telemetry-collector/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/operations/observability/tracing/otel-collector/open-telemetry-collector/</guid><description>&lt;p>Dapr 推荐使用 OpenTelemetry (OTLP) 协议来写入追踪数据。对于直接支持 OTLP 的可观测性工具，建议使用 &lt;a href="https://github.com/open-telemetry/opentelemetry-collector">OpenTelemetry Collector&lt;/a>，因为它可以快速卸载数据，并提供重试、批处理和加密等功能。更多信息请参阅 Open Telemetry Collector 的&lt;a href="https://opentelemetry.io/docs/collector/#when-to-use-a-collector">文档&lt;/a>。&lt;/p>
&lt;p>Dapr 也支持使用 Zipkin 协议来写入追踪数据。在 OTLP 协议支持之前，Zipkin 协议与 OpenTelemetry Collector 一起使用，以将追踪数据发送到 AWS X-Ray、Google Cloud Operations Suite 和 Azure Monitor 等可观测性工具。虽然两种协议都有效，但推荐使用 OpenTelemetry 协议。&lt;/p>
&lt;p>&lt;img src="https://v1-18.docs.dapr.io/images/open-telemetry-collector.png" alt="使用 OpenTelemetry Collector 集成多个后端">&lt;/p>
&lt;h2 id="先决条件">先决条件&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://v1-18.docs.dapr.io/zh-hans/operations/hosting/kubernetes/">在 Kubernetes 上安装 Dapr&lt;/a>&lt;/li>
&lt;li>确保您的追踪后端已准备好接收追踪数据&lt;/li>
&lt;li>查看 OTEL Collector 导出器所需的参数：
&lt;ul>
&lt;li>&lt;a href="https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter">&lt;code>opentelemetry-collector-contrib/exporter&lt;/code>&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter">&lt;code>opentelemetry-collector/exporter&lt;/code>&lt;/a>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;h2 id="配置-otel-collector-推送追踪数据到您的后端">配置 OTEL Collector 推送追踪数据到您的后端&lt;/h2>
&lt;ol>
&lt;li>
&lt;p>查看 &lt;a href="https://v1-18.docs.dapr.io/docs/open-telemetry-collector/open-telemetry-collector-generic.yaml">&lt;code>open-telemetry-collector-generic.yaml&lt;/code>&lt;/a>。&lt;/p>
&lt;/li>
&lt;li>
&lt;p>将 &lt;code>&amp;lt;your-exporter-here&amp;gt;&lt;/code> 替换为您的追踪导出器的实际配置。&lt;/p>
&lt;ul>
&lt;li>请参考&lt;a href="https://v1-18.docs.dapr.io/zh-hans/operations/observability/tracing/otel-collector/open-telemetry-collector/#prerequisites.md">先决条件部分&lt;/a>中的 OTEL Collector 链接以获取正确的配置。&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>使用以下命令应用配置：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>kubectl apply -f open-telemetry-collector-generic.yaml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;/ol>
&lt;h2 id="配置-dapr-发送追踪数据到-otel-collector">配置 Dapr 发送追踪数据到 OTEL Collector&lt;/h2>
&lt;p>创建一个 Dapr 配置文件以启用追踪，并部署一个使用 OpenTelemetry Collector 的追踪导出器组件。&lt;/p></description></item><item><title>使用 OpenTelemetry Collector 将跟踪信息发送到应用程序洞察</title><link>https://v1-18.docs.dapr.io/zh-hans/operations/observability/tracing/otel-collector/open-telemetry-collector-appinsights/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/operations/observability/tracing/otel-collector/open-telemetry-collector-appinsights/</guid><description>&lt;p>Dapr 使用 Zipkin API 集成了 &lt;a href="https://github.com/open-telemetry/opentelemetry-collector">OpenTelemetry (OTEL) Collector&lt;/a>。本指南演示了如何通过 Dapr 使用 OpenTelemetry Collector 将跟踪事件推送到 Azure 应用程序洞察。&lt;/p>
&lt;h2 id="前提条件">前提条件&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://v1-18.docs.dapr.io/zh-hans/operations/hosting/kubernetes/">在 Kubernetes 上安装 Dapr&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource">设置一个应用程序洞察资源&lt;/a>并记录下你的应用程序洞察仪器密钥。&lt;/li>
&lt;/ul>
&lt;h2 id="配置-otel-collector-以推送数据到应用程序洞察">配置 OTEL Collector 以推送数据到应用程序洞察&lt;/h2>
&lt;p>要将事件推送到你的应用程序洞察实例，请在 Kubernetes 集群中安装 OTEL Collector。&lt;/p>
&lt;ol>
&lt;li>
&lt;p>查看 &lt;a href="https://v1-18.docs.dapr.io/docs/open-telemetry-collector/open-telemetry-collector-appinsights.yaml">&lt;code>open-telemetry-collector-appinsights.yaml&lt;/code>&lt;/a> 文件。&lt;/p>
&lt;/li>
&lt;li>
&lt;p>用你的应用程序洞察仪器密钥替换 &lt;code>&amp;lt;INSTRUMENTATION-KEY&amp;gt;&lt;/code> 占位符。&lt;/p>
&lt;/li>
&lt;li>
&lt;p>使用以下命令应用配置：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>kubectl apply -f open-telemetry-collector-appinsights.yaml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;/ol>
&lt;h2 id="配置-dapr-以发送跟踪数据到-otel-collector">配置 Dapr 以发送跟踪数据到 OTEL Collector&lt;/h2>
&lt;p>创建一个 Dapr 配置文件以启用跟踪，并部署一个使用 OpenTelemetry Collector 的跟踪导出组件。&lt;/p>
&lt;ol>
&lt;li>
&lt;p>使用此 &lt;a href="https://v1-18.docs.dapr.io/docs/open-telemetry-collector/collector-config.yaml">&lt;code>collector-config.yaml&lt;/code>&lt;/a> 文件创建你自己的配置。&lt;/p>
&lt;/li>
&lt;li>
&lt;p>使用以下命令应用配置：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>kubectl apply -f collector-config.yaml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;/ol>
&lt;h2 id="部署应用程序并启用跟踪">部署应用程序并启用跟踪&lt;/h2>
&lt;p>在你希望参与分布式跟踪的容器中添加 &lt;code>dapr.io/config&lt;/code> 注解以应用 &lt;code>appconfig&lt;/code> 配置，如下例所示：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">apiVersion&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">apps/v1&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">kind&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">Deployment&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">metadata&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">...&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">spec&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">...&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">template&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">metadata&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">...&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">annotations&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">dapr.io/enabled&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#4e9a06">&amp;#34;true&amp;#34;&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">dapr.io/app-id&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#4e9a06">&amp;#34;MyApp&amp;#34;&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">dapr.io/app-port&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#4e9a06">&amp;#34;8080&amp;#34;&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">dapr.io/config&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#4e9a06">&amp;#34;appconfig&amp;#34;&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>

&lt;div class="alert alert-primary" role="alert">
&lt;h4 class="alert-heading">注意&lt;/h4>

 如果你正在使用 Dapr 教程之一，例如 &lt;a href="https://github.com/dapr/quickstarts/tree/master/tutorials/distributed-calculator">分布式计算器&lt;/a>，&lt;code>appconfig&lt;/code> 配置已经设置好，因此不需要额外的配置。

&lt;/div>

&lt;p>你可以同时注册多个跟踪导出器，跟踪日志会被转发到所有注册的导出器。&lt;/p></description></item><item><title>使用 OpenTelemetry Collector 收集追踪信息并发送到 Jaeger</title><link>https://v1-18.docs.dapr.io/zh-hans/operations/observability/tracing/otel-collector/open-telemetry-collector-jaeger/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/operations/observability/tracing/otel-collector/open-telemetry-collector-jaeger/</guid><description>&lt;p>Dapr 支持通过 OpenTelemetry (OTLP) 和 Zipkin 协议进行追踪信息的写入。然而，由于 Jaeger 对 Zipkin 的支持已被弃用，建议使用 OTLP。虽然 Jaeger 可以直接支持 OTLP，但在生产环境中，推荐使用 OpenTelemetry Collector 从 Dapr 收集追踪信息并发送到 Jaeger。这样可以让您的应用程序更高效地处理数据，并利用重试、批处理和加密等功能。更多信息请阅读 Open Telemetry Collector &lt;a href="https://opentelemetry.io/docs/collector/#when-to-use-a-collector">文档&lt;/a>。






&lt;ul class="nav nav-tabs" id="tabs-0" role="tablist">
 &lt;li class="nav-item">
 &lt;button class="nav-link active"
 id="tabs-00-00-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-00" role="tab"
 data-td-tp-persist="self-hosted" aria-controls="tabs-00-00" aria-selected="true">
 Self-hosted
 &lt;/button>
 &lt;/li>&lt;li class="nav-item">
 &lt;button class="nav-link"
 id="tabs-00-01-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-01" role="tab"
 data-td-tp-persist="kubernetes" aria-controls="tabs-00-01" aria-selected="false">
 Kubernetes
 &lt;/button>
 &lt;/li>
&lt;/ul>

&lt;div class="tab-content" id="tabs-0-content">
 &lt;div class="tab-body tab-pane fade show active"
 id="tabs-00-00" role="tabpanel" aria-labelled-by="tabs-00-00-tab" tabindex="0">
 &lt;!-- self-hosted -->
&lt;h2 id="在自托管模式下配置-jaeger">在自托管模式下配置 Jaeger&lt;/h2>
&lt;h3 id="本地设置">本地设置&lt;/h3>
&lt;p>启动 Jaeger 的最简单方法是运行发布到 DockerHub 的预构建的 all-in-one Jaeger 镜像，并暴露 OTLP 端口：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>docker run -d --name jaeger &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> -p 4317:4317 &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> -p 16686:16686 &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> jaegertracing/all-in-one:1.49
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>接下来，在本地创建以下 &lt;code>config.yaml&lt;/code> 文件：&lt;/p></description></item></channel></rss>