istio.io/archive/v1.2/zh/faq/telemetry/index.html

33 lines
16 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html><html lang=zh itemscope itemtype=https://schema.org/WebPage><head><meta charset=utf-8><meta http-equiv=x-ua-compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name=theme-color content=#466BB0><meta name=title content="遥测 FAQ"><meta name=description content="遥测 Q &amp; A."><meta name=keywords content=microservices,services,mesh><meta property=og:title content="遥测 FAQ"><meta property=og:type content=website><meta property=og:description content="遥测 Q &amp; A."><meta property=og:url content=/v1.2/zh/faq/telemetry/><meta property=og:image content=/v1.2/img/istio-whitelogo-bluebackground-framed.svg><meta property=og:image:alt content="Istio Logo"><meta property=og:image:width content=112><meta property=og:image:height content=150><meta property=og:site_name content=Istio><meta name=twitter:card content=summary><meta name=twitter:site content=@IstioMesh><title>Istioldie 1.2 / 遥测 FAQ</title><script async src="https://www.googletagmanager.com/gtag/js?id=UA-98480406-2"></script><script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}
gtag('js',new Date());gtag('config','UA-98480406-2');</script><link rel=alternate type=application/rss+xml title="Istio Blog" href=/v1.2/feed.xml><link rel="shortcut icon" href=/v1.2/favicons/favicon.ico><link rel=apple-touch-icon href=/v1.2/favicons/apple-touch-icon-180x180.png sizes=180x180><link rel=icon type=image/png href=/v1.2/favicons/favicon-16x16.png sizes=16x16><link rel=icon type=image/png href=/v1.2/favicons/favicon-32x32.png sizes=32x32><link rel=icon type=image/png href=/v1.2/favicons/android-36x36.png sizes=36x36><link rel=icon type=image/png href=/v1.2/favicons/android-48x48.png sizes=48x48><link rel=icon type=image/png href=/v1.2/favicons/android-72x72.png sizes=72x72><link rel=icon type=image/png href=/v1.2/favicons/android-96x96.png sizes=96xW96><link rel=icon type=image/png href=/v1.2/favicons/android-144x144.png sizes=144x144><link rel=icon type=image/png href=/v1.2/favicons/android-192x192.png sizes=192x192><link rel=manifest href=/v1.2/manifest.json><meta name=apple-mobile-web-app-title content=Istio><meta name=application-name content=Istio><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Work+Sans:400|Chivo:400|Work+Sans:500,300,600,300italic,400italic,500italic,600italic|Chivo:500,300,600,300italic,400italic,500italic,600italic"><link rel=stylesheet href=/v1.2/css/all.css><script src=/v1.2/js/themes_init.min.js></script></head><body class="language-unknown archive-site"><script>const branchName="release-1.2";const docTitle="遥测 FAQ";const iconFile="\/v1.2/img/icons.svg";const buttonCopy='复制到剪切板';const buttonPrint='打印';const buttonDownload='下载';</script><script src="https://www.google.com/cse/brand?form=search-form" defer></script><script src=/v1.2/js/all.min.js data-manual defer></script><header><nav><a id=brand href=/v1.2/zh/><span class=logo><svg viewBox="0 0 300 300"><circle cx="150" cy="150" r="146" stroke-width="2" /><path d="M65 240H225L125 270z"/><path d="M65 230l60-10V110z"/><path d="M135 220l90 10L135 30z"/></svg></span><span class=name>Istioldie 1.2</span></a><div id=hamburger><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#hamburger"/></svg></div><div id=header-links><a title="了解如何部署、使用和运维 Istio。" href=/v1.2/zh/docs/>文档</a>
<a title="关于使用 Istio 的博客文章。" href=/v1.2/zh/blog/2019/announcing-1.1.3/>博客</a>
<span title=关于Istio的常见问题。>FAQ</span>
<a title=关于Istio的说明。 href=/v1.2/zh/about/>关于</a><div class=menu><button id=gearDropdownButton class=menu-trigger title=选项和设置 aria-label="Options and Settings" aria-controls=gearDropdownContent><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#gear"/></svg></button><div id=gearDropdownContent class=menu-content aria-labelledby=gearDropdownButton role=menu><a tabindex=-1 role=menuitem lang=en id=switch-lang-en>English</a>
<a tabindex=-1 role=menuitem lang=zh id=switch-lang-zh class=active>中文</a><div role=separator></div><a tabindex=-1 role=menuitem class=active id=light-theme-item>亮主题</a>
<a tabindex=-1 role=menuitem id=dark-theme-item>暗主题</a><div role=separator></div><a tabindex=-1 role=menuitem id=syntax-coloring-item>代码高亮</a><div role=separator></div><h6>本站的其它版本</h6><a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://istio.io/faq\/telemetry\/');return false;">当前版本</a>
<a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://preliminary.istio.io/faq\/telemetry\/');return false;">下个版本</a>
<a tabindex=-1 role=menuitem href=https://archive.istio.io>旧版本</a></div></div><button id=search-show title=搜索istio.io aria-label=Search><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#magnifier"/></svg></button></div><form id=search-form name=cse role=search><input type=hidden name=cx value=013699703217164175118:iwwf17ikgf4>
<input type=hidden name=ie value=utf-8>
<input type=hidden name=hl value=en>
<input type=hidden id=search-page-url value=/v1.2/search.html>
<input id=search-textbox class=form-control name=q type=search aria-label=搜索istio.io>
<button id=search-close title="Cancel search" type=reset aria-label="Cancel search"><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#cancel-x"/></svg></button></form></nav></header><main class="primary notoc"><div id=sidebar-container class="sidebar-container sidebar-offcanvas"><nav id=sidebar aria-label="Section Navigation"><div class=directory><div class=card><div id=header0 class=header title=关于Istio的常见问题。><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#faq"/></svg>FAQ</div><div class="body default" aria-labelledby=header0><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=header0><li role=none><a role=treeitem title=常见问题。 href=/v1.2/zh/faq/general/>常见问题</a></li><li role=none><a role=treeitem title="安装 Q &amp; A。" href=/v1.2/zh/faq/setup/>安装</a></li><li role=none><a role=treeitem title=安全方面的常见问题。 href=/v1.2/zh/faq/security/>安全</a></li><li role=none><a role=treeitem title="Mixer Q &amp; A。" href=/v1.2/zh/faq/mixer/>Mixer</a></li><li role=none><a role=treeitem title=度量和日志的常见问题。 href=/v1.2/zh/faq/metrics-and-logs/>度量和日志</a></li><li role=none><span role=treeitem class=current title="遥测 Q &amp; A.">遥测</span></li><li role=none><a role=treeitem title=分布式追踪问答。 href=/v1.2/zh/faq/distributed-tracing/>分布式追踪</a></li><li role=none><a role=treeitem title="流量管理 Q &amp; A。" href=/v1.2/zh/faq/traffic-management/>流量管理</a></li></ul></div></div></div></nav></div><div class=article-container><nav aria-label=Breadcrumb><ol><li><a href=/v1.2/zh/>Istio</a></li><li><a href=/v1.2/zh/faq/ title=关于Istio的常见问题。>FAQ</a></li><li>遥测</li></ol></nav><article aria-labelledby=title><div class=title-area><i class=title-icon><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#faq"/></svg></i><div><h1 id=title>遥测 FAQ</h1></div></div><nav class="toc-inlined toc-forced"><hr><div class=directory role=directory><nav id=InlineTableOfContents><ol><li role=none aria-label="遥测数据可以通过 REST 接口查看吗?"><a href=#accessing-telemetry-via-rest>遥测数据可以通过 REST 接口查看吗?</a></li><li role=none aria-label="为什么 Istio 不能取代应用程序来传播 header"><a href=#istio-copy-headers>为什么 Istio 不能取代应用程序来传播 header</a></li><li role=none aria-label="如何控制由 sidecar 上报的数据?"><a href=#controlling-what-the-sidecar-reports>如何控制由 sidecar 上报的数据?</a></li><li role=none aria-label=请求没有被追踪><a href=#no-tracing>请求没有被追踪</a></li><li role=none aria-label="Prometheus 适配器可以用于非 Kubernetes 环境吗?"><a href=#prometheus-for-non-k8s>Prometheus 适配器可以用于非 Kubernetes 环境吗?</a></li><li role=none aria-label="Istio 支持追踪 vert.x 事件总线消息吗?"><a href=#vert.x>Istio 支持追踪 vert.x 事件总线消息吗?</a></li><li role=none aria-label="如何禁用 Istio 发送追踪 span 至 Zipkin"><a href=#disabling-zipkin>如何禁用 Istio 发送追踪 span 至 Zipkin</a></li><li role=none aria-label="Istio 能将追踪信息发送到外部 ZipKin 实例吗?"><a href=#external-zipkin>Istio 能将追踪信息发送到外部 ZipKin 实例吗?</a></li><li role=none aria-label="在 Istio 使用 ZipKin 功能时,是否可以返回 x-request-id"><a href=#zipkin-and-x-request-id>在 Istio 使用 ZipKin 功能时,是否可以返回 x-request-id</a></li></ol></nav></div><hr></nav><div class=faq><h5 id=accessing-telemetry-via-rest class=question>遥测数据可以通过 REST 接口查看吗?</h5><div class=answer><p>可以使用 <a href=/v1.2/zh/docs/tasks/telemetry/metrics/querying-metrics/>Prometheus</a> 收集有关 Istio 的遥测数据。然后使用 <a href=https://prometheus.io/docs/prometheus/latest/querying/api/>Prometheuss HTTP API</a> 查询数据。</p></div><h5 id=istio-copy-headers class=question>为什么 Istio 不能取代应用程序来传播 header</h5><div class=answer><p>尽管 Istio sidecar 将处理与之关联的应用程序实例的入站和出站请求,但它并不能隐式地将出站请求和与该出站请求对应的入站请求建立联系。
实现这种相关性的唯一方法是应用程序<a href=/v1.2/zh/docs/tasks/telemetry/distributed-tracing/overview/#trace-context-propagation>传递从入站请求到出站请求的关联信息</a>比如Header</p></div><h5 id=controlling-what-the-sidecar-reports class=question>如何控制由 sidecar 上报的数据?</h5><div class=answer><p>有时,禁止上报特定 URL 的访问信息也是有用的。比如,用户可能会想要排除一些健康检查的 URL。为了跳过特定 URL 的遥测报告,用户可以通过使用遥测配置中的 <code>match</code> 子句来实现。比如:</p><pre><code class=language-yaml data-expandlinks=true>match: source.name != &#34;health&#34;
</code></pre></div><h5 id=no-tracing class=question>请求没有被追踪</h5><div class=answer><p>从 Istio 1.0.3 开始,使用 helm chart 安装的 Istio其默认追踪采样率已经降低到 1%。
这意味着 Istio 捕获的 100 个追踪实例中只有 1 个将被报告给追踪后端。
<code>istio-demo.yaml</code> 文件中的采样率仍设为 100%。
有关如何设置采样率的更多信息,请参见<a href=/v1.2/docs/tasks/telemetry/distributed-tracing>本节</a></p></div><h5 id=prometheus-for-non-k8s class=question>Prometheus 适配器可以用于非 Kubernetes 环境吗?</h5><div class=answer><p>可以使用 docker-compose 来安装 Prometheus这与<a href=/v1.2/zh/docs/setup/consul/quick-start/#部署应用>安装</a>应用程序十分类似。此外,如果没有 Kubernetes API 服务器,像 Mixer 这样的组件将会对规则、处理程序以及实例进行本地配置。</p></div><h5 id=vert.x class=question>Istio 支持追踪 vert.x 事件总线消息吗?</h5><div class=answer><p>Istio 目前不支持 pub/sub 和事件总线协议。任何使用追踪技术的场景都是尽力而为的,可能会有消息丢失。</p></div><h5 id=disabling-zipkin class=question>如何禁用 Istio 发送追踪 span 至 Zipkin</h5><div class=answer><p>如果已启用追踪,则可以按如下方式禁用:</p><pre><code class=language-plain data-expandlinks=true># 使用 Istio 所在命名空间名称来替换 &lt;istio namespace&gt;例如istio-system。
TRACING_POD=`kubectl get po -n &lt;istio namespace&gt; | grep istio-tracing | awk {print $1}`
$ kubectl delete pod $TRACING_POD -n &lt;istio namespace&gt;
$ kubectl delete services tracing zipkin -n &lt;istio namespace&gt;
# 从 mixer 部署中删除 Zipkin 的 url。
$ kubectl -n istio-system edit deployment istio-telemetry
# 然后手工从文件中删除 trace_zipkin_url 的实例并保存。
</code></pre><p>然后按照<a href=/v1.2/zh/docs/tasks/telemetry/distributed-tracing/zipkin/#清理>分布式追踪任务的清理部分</a>的步骤进行操作。</p><p>如果完全不想使用追踪功能,可在 <code>istio-demo.yaml</code><code>istio-demo-auth.yaml</code><a href=/v1.2/zh/docs/tasks/telemetry/distributed-tracing/zipkin/#开始之前>禁用追踪功能</a>,或者在安装 Istio 时不启用它。</p></div><h5 id=external-zipkin class=question>Istio 能将追踪信息发送到外部 ZipKin 实例吗?</h5><div class=answer><p>要实现该功能,必须使用 Zipkin 实例的完全限定域名。例如:</p><p><code>zipkin.mynamespace.svc.cluster.local</code></p></div><h5 id=zipkin-and-x-request-id class=question>在 Istio 使用 ZipKin 功能时,是否可以返回 x-request-id</h5><div class=answer><p>除非复制 Header否则 Istio 也无法知道接受原始请求的应用程序何时给出响应消息。如果复制 Header则可以将其包含在响应 Header 中。</p></div></div></article><nav class=pagenav><div class=left><a title=度量和日志的常见问题。 href=/v1.2/zh/faq/metrics-and-logs/><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#left-arrow"/></svg>度量和日志</a></div><div class=right><a title=分布式追踪问答。 href=/v1.2/zh/faq/distributed-tracing/>分布式追踪<svg class="icon"><use xlink:href="/v1.2/img/icons.svg#right-arrow"/></svg></a></div></nav><div id=endnotes-container aria-hidden=true><h2>链接</h2><ol id=endnotes></ol></div></div></main><footer><div class=user-links><a class=channel title="Go download Istio 1.2.5 now" href=https://github.com/istio/istio/releases/tag/1.2.5 aria-label="Download Istio"><span>download</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#download"/></svg>
</a><a class=channel title="加入 Istio discussion board 参与讨论获取帮助" href=https://discuss.istio.io aria-label="Istio discussion board"><span>discuss</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#discourse"/></svg></a>
<a class=channel title="Stack Overflow 中列举了针对实际问题以及部署、配置和使用 Istio 的各项回答" href=https://stackoverflow.com/questions/tagged/istio aria-label="Stack Overflow"><span>stack overflow</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#stackoverflow"/></svg></a>
<a class=channel title="在 Slack 上与 Istio 社区交互讨论开发问题(仅限邀请)" href=https://istio.slack.com aria-label=slack><span>slack</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#slack"/></svg></a>
<a class=channel title="关注我们的 Twitter 来获取最新信息" href=https://twitter.com/IstioMesh aria-label=Twitter><span>twitter</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#twitter"/></svg></a><div class=tag>对于用户</div></div><div class=info><p class=copyright>中文内容由 ServiceMesher 社区维护,部分文档可能稍微滞后于英文版本,同步工作持续进行中<br>Istio 归档
1.2.5<br>&copy; 2019 Istio Authors, <a href=https://policies.google.com/privacy>隐私政策</a><br>归档于 2019年9月12日</p></div><div class=dev-links><a class=channel title="Istio 的代码在 GitHub 上开发" href=https://github.com/istio/community aria-label=GitHub><span>github</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#github"/></svg></a>
<a class=channel title="如果您想深入了解 Istio 的技术细节,请查看我们日益完善的设计文档" href=https://groups.google.com/forum/#!forum/istio-team-drive-access aria-label="team drive"><span>drive</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#drive"/></svg></a>
<a class=channel title="如果您想为 Istio 项目做出贡献,请考虑加入我们的工作组" href=https://github.com/istio/community/blob/master/WORKING-GROUPS.md aria-label="working groups"><span>working groups</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#working-groups"/></svg></a><div class=tag>对于开发者</div></div></footer><div id=scroll-to-top-container aria-hidden=true><button id=scroll-to-top title=回到顶部><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#top"/></svg></button></div></body></html>