<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>监控指标 on Dapr 文档库</title><link>https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/</link><description>Recent content in 监控指标 on Dapr 文档库</description><generator>Hugo</generator><language>zh-hans</language><atom:link href="https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/index.xml" rel="self" type="application/rss+xml"/><item><title>操作指南：使用 Prometheus 监控指标</title><link>https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/prometheus/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/prometheus/</guid><description>&lt;h2 id="本地设置-prometheus">本地设置 Prometheus&lt;/h2>
&lt;p>在本地计算机上，您可以选择&lt;a href="https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/prometheus/#install">安装并作为进程运行&lt;/a> Prometheus，或者将其作为&lt;a href="https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/prometheus/#Run-as-Container">Docker 容器运行&lt;/a>。&lt;/p>
&lt;h3 id="安装">安装&lt;/h3>


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

 如果您计划将 Prometheus 作为 Docker 容器运行，则无需单独安装 Prometheus。请参阅&lt;a href="https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/prometheus/#run-as-container">容器&lt;/a>部分的说明。

&lt;/div>

&lt;p>请按照&lt;a href="https://prometheus.io/docs/prometheus/latest/getting_started/">此处&lt;/a>提供的步骤，根据您的操作系统安装 Prometheus。&lt;/p>
&lt;h3 id="配置">配置&lt;/h3>
&lt;p>安装完成后，您需要创建一个配置文件。&lt;/p>
&lt;p>以下是一个示例 Prometheus 配置，请将其保存为文件，例如 &lt;code>/tmp/prometheus.yml&lt;/code> 或 &lt;code>C:\Temp\prometheus.yml&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">global&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">scrape_interval&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">15s&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#8f5902;font-style:italic"># 默认情况下，每 15 秒收集一次指标。&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>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#8f5902;font-style:italic"># 包含一个收集端点的配置：&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:#8f5902;font-style:italic"># 这里是 Prometheus 自身。&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">scrape_configs&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">job_name&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;#39;dapr&amp;#39;&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>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#8f5902;font-style:italic"># 覆盖全局默认值，每 5 秒从此 job 收集指标。&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">scrape_interval&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">5s&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>&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">static_configs&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">targets&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;font-weight:bold">[&lt;/span>&lt;span style="color:#4e9a06">&amp;#39;localhost:9090&amp;#39;&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:#8f5902;font-style:italic"># 如果不是默认值，请替换为 Dapr 指标端口&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="作为进程运行">作为进程运行&lt;/h3>
&lt;p>使用您的配置文件运行 Prometheus，以开始从指定目标收集指标。&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>./prometheus --config.file&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>/tmp/prometheus.yml --web.listen-address&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>:8080
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;blockquote>
&lt;p>我们更改了端口以避免与 Dapr 自身的指标端点冲突。&lt;/p></description></item><item><title>配置指标</title><link>https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/metrics-overview/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/metrics-overview/</guid><description>&lt;p>默认情况下，每个Dapr系统进程都会发出Go运行时和进程指标，并拥有自己的&lt;a href="https://github.com/dapr/dapr/blob/master/docs/development/dapr-metrics.md">Dapr指标&lt;/a>。&lt;/p>
&lt;h2 id="prometheus端点">Prometheus端点&lt;/h2>
&lt;p>Dapr sidecar提供了一个与&lt;a href="https://prometheus.io/">Prometheus&lt;/a>兼容的指标端点，您可以通过抓取该端点来更好地了解Dapr的运行状况。&lt;/p>
&lt;h2 id="使用cli配置指标">使用CLI配置指标&lt;/h2>
&lt;p>指标应用程序端点默认是启用的。您可以通过传递命令行参数&lt;code>--enable-metrics=false&lt;/code>来禁用它。&lt;/p>
&lt;p>默认的指标端口是&lt;code>9090&lt;/code>。您可以通过传递命令行参数&lt;code>--metrics-port&lt;/code>给daprd来更改此设置。&lt;/p>
&lt;h2 id="在kubernetes中配置指标">在Kubernetes中配置指标&lt;/h2>
&lt;p>您还可以通过在应用程序部署上设置&lt;code>dapr.io/enable-metrics: &amp;quot;false&amp;quot;&lt;/code>注解来启用或禁用特定应用程序的指标。禁用指标导出器后，daprd不会打开指标监听端口。&lt;/p>
&lt;p>以下Kubernetes部署示例显示了如何显式启用指标，并将端口指定为&amp;quot;9090&amp;quot;。&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:#204a87;font-weight:bold">name&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">nodeapp&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">labels&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">app&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">node&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:#204a87;font-weight:bold">replicas&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:#0000cf;font-weight:bold">1&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">selector&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">matchLabels&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">app&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">node&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:#204a87;font-weight:bold">labels&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">app&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">node&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;nodeapp&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;3000&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/enable-metrics&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/metrics-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;9090&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">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:#204a87;font-weight:bold">containers&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">name&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">node&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">image&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">dapriosamples/hello-k8s-node:latest&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">ports&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">containerPort&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:#0000cf;font-weight:bold">3000&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">imagePullPolicy&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">Always&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="使用应用程序配置启用指标">使用应用程序配置启用指标&lt;/h2>
&lt;p>您还可以通过应用程序配置启用指标。要默认禁用Dapr sidecar中的指标收集，请将&lt;code>spec.metrics.enabled&lt;/code>设置为&lt;code>false&lt;/code>。&lt;/p></description></item><item><title>如何使用Grafana监控指标</title><link>https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/grafana/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/grafana/</guid><description>&lt;h2 id="可用的仪表板">可用的仪表板&lt;/h2>








&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="系统服务" aria-controls="tabs-00-00" aria-selected="true">
 系统服务
 &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="sidecar" aria-controls="tabs-00-01" aria-selected="false">
 sidecar
 &lt;/button>
 &lt;/li>&lt;li class="nav-item">
 &lt;button class="nav-link"
 id="tabs-00-02-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-02" role="tab"
 data-td-tp-persist="actor" aria-controls="tabs-00-02" aria-selected="false">
 actor
 &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;p>&lt;code>grafana-system-services-dashboard.json&lt;/code>模板展示了Dapr系统组件的状态，包括dapr-operator、dapr-sidecar-injector、dapr-sentry和dapr-placement：&lt;/p>
&lt;img src="https://v1-18.docs.dapr.io/images/grafana-system-service-dashboard.png" alt="系统服务仪表板的截图" width=1200>

 &lt;/div>
 &lt;div class="tab-body tab-pane fade"
 id="tabs-00-01" role="tabpanel" aria-labelled-by="tabs-00-01-tab" tabindex="0">
 &lt;p>&lt;code>grafana-sidecar-dashboard.json&lt;/code>模板展示了Dapr sidecar 的状态，包括sidecar 的健康状况/资源使用情况、HTTP和gRPC的吞吐量/延迟、actor、mTLS等：&lt;/p>
&lt;img src="https://v1-18.docs.dapr.io/images/grafana-sidecar-dashboard.png" alt="sidecar仪表板的截图" width=1200>

 &lt;/div>
 &lt;div class="tab-body tab-pane fade"
 id="tabs-00-02" role="tabpanel" aria-labelled-by="tabs-00-02-tab" tabindex="0">
 &lt;p>&lt;code>grafana-actor-dashboard.json&lt;/code>模板展示了Dapr sidecar 的状态、actor 调用的吞吐量/延迟、timer/reminder触发器和基于回合的并发性：&lt;/p>
&lt;img src="https://v1-18.docs.dapr.io/images/grafana-actor-dashboard.png" alt="actor仪表板的截图" width=1200>

 &lt;/div>
&lt;/div>

&lt;h2 id="前提条件">前提条件&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/prometheus/">设置Prometheus&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="在kubernetes上设置">在Kubernetes上设置&lt;/h2>
&lt;h3 id="安装grafana">安装Grafana&lt;/h3>
&lt;ol>
&lt;li>
&lt;p>添加Grafana Helm仓库：&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>helm repo add grafana https://grafana.github.io/helm-charts
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>helm repo update
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&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-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>helm install grafana grafana/grafana -n dapr-monitoring
&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>

 &lt;p>如果您使用Minikube或希望在开发中禁用持久卷，可以使用以下命令禁用：&lt;/p></description></item><item><title>操作指南：配置 New Relic 以收集和分析指标</title><link>https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/newrelic/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/newrelic/</guid><description>&lt;h2 id="前提条件">前提条件&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://newrelic.com/signup?ref=dapr">New Relic 账户&lt;/a>，永久免费，每月提供 100 GB 的免费数据摄取，1 个免费完全访问用户，无限制的免费基本用户&lt;/li>
&lt;/ul>
&lt;h2 id="背景信息">背景信息&lt;/h2>
&lt;p>New Relic 支持 Prometheus 的 OpenMetrics 集成。&lt;/p>
&lt;p>本文档将介绍如何在集群中安装该集成，建议使用 Helm chart 进行安装。&lt;/p>
&lt;h2 id="安装步骤">安装步骤&lt;/h2>
&lt;ol>
&lt;li>
&lt;p>根据官方说明安装 Helm。&lt;/p>
&lt;/li>
&lt;li>
&lt;p>按照&lt;a href="https://github.com/newrelic/helm-charts/blob/master/README.md#installing-charts">这些说明&lt;/a>添加 New Relic 官方 Helm chart 仓库。&lt;/p>
&lt;/li>
&lt;li>
&lt;p>运行以下命令通过 Helm 安装 New Relic Logging Kubernetes 插件，并将 YOUR_LICENSE_KEY 替换为您的 &lt;a href="https://docs.newrelic.com/docs/accounts/accounts-billing/account-setup/new-relic-license-key">New Relic 许可证密钥&lt;/a>：&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>helm install nri-prometheus newrelic/nri-prometheus --set &lt;span style="color:#000">licenseKey&lt;/span>&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>YOUR_LICENSE_KEY
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;/ol>
&lt;h2 id="查看指标">查看指标&lt;/h2>
&lt;p>&lt;img src="https://v1-18.docs.dapr.io/images/nr-metrics-1.png" alt="Dapr 指标">&lt;/p>
&lt;p>&lt;img src="https://v1-18.docs.dapr.io/images/nr-dashboard-dapr-metrics-1.png" alt="仪表板">&lt;/p>
&lt;h2 id="相关链接参考">相关链接/参考&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://newrelic.com/signup">New Relic 账户注册&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://newrelic.com/platform/telemetry-data-platform">遥测数据平台&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/newrelic/helm-charts/tree/master/charts/nri-prometheus">New Relic Prometheus OpenMetrics 集成&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/">New Relic API 密钥类型&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.newrelic.com/docs/alerts-applied-intelligence/overview/">警报和应用智能&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>操作指南：配置 Azure Monitor 以搜索日志和收集指标</title><link>https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/azure-monitor/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/operations/observability/metrics/azure-monitor/</guid><description>&lt;h2 id="前提条件">前提条件&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://docs.microsoft.com/azure/aks/">Azure Kubernetes Service&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.microsoft.com/azure/azure-monitor/insights/container-insights-overview">在 AKS 中启用 Azure Monitor For 容器&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://kubernetes.io/docs/tasks/tools/">kubectl&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://helm.sh/">Helm 3&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="使用配置映射启用-prometheus-指标抓取">使用配置映射启用 Prometheus 指标抓取&lt;/h2>
&lt;ol>
&lt;li>
&lt;p>确认 Azure Monitor Agents (AMA) 正在运行。&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>$ kubectl get pods -n kube-system
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>NAME READY STATUS RESTARTS AGE
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>...
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ama-logs-48kpv 2/2 Running &lt;span style="color:#0000cf;font-weight:bold">0&lt;/span> 2d13h
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ama-logs-mx24c 2/2 Running &lt;span style="color:#0000cf;font-weight:bold">0&lt;/span> 2d13h
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ama-logs-rs-f9bbb9898-vbt6k 1/1 Running &lt;span style="color:#0000cf;font-weight:bold">0&lt;/span> 30h
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ama-logs-sm2mz 2/2 Running &lt;span style="color:#0000cf;font-weight:bold">0&lt;/span> 2d13h
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ama-logs-z7p4c 2/2 Running &lt;span style="color:#0000cf;font-weight:bold">0&lt;/span> 2d13h
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>...
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>使用配置映射启用 Prometheus 指标端点抓取。&lt;/p>
&lt;p>可以使用 &lt;a href="https://v1-18.docs.dapr.io/docs/azm-config-map.yaml">azm-config-map.yaml&lt;/a> 来启用 Prometheus 指标端点抓取。&lt;/p>
&lt;p>如果 Dapr 安装在不同的命名空间，需要修改 &lt;code>monitor_kubernetes_pod_namespaces&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:#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">prometheus-data-collection-settings&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;font-weight:bold">|-&lt;/span>&lt;span style="color:#8f5902;font-style:italic">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> [prometheus_data_collection_settings.cluster]
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> interval = &amp;#34;1m&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> monitor_kubernetes_pods = true
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> monitor_kubernetes_pods_namespaces = [&amp;#34;dapr-system&amp;#34;, &amp;#34;default&amp;#34;]
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> [prometheus_data_collection_settings.node]
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> interval = &amp;#34;1m&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:#000">...&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>应用配置映射：&lt;/p></description></item></channel></rss>