Opentelemetry——Sampling

Sampling

采样

Learn about sampling, and the different sampling options available in OpenTelemetry.
了解采样以及 OpenTelemetry 中提供的不同采样选项。

With distributed tracing, you observe requests as they move from one service to another in a distributed system. It’s superbly practical for a number of reasons, such as understanding your service connections and diagnosing latency issues, among many other benefits.
使用分布式跟踪,您可以观察请求在分布式系统中从一个服务到另一个服务的传递情况。出于多种原因,这对于理解服务连接和诊断延迟问题非常实用。

However, if the majority of all your requests are successful 200s and finish without unacceptable latency or errors, do you really need all that data? Here’s the thing—you don’t always need a ton of data to find the right insights. You just need the right sampling of data.
但是,如果您的所有请求中的大多数都在 200 秒内成功完成并且没有出现不可接受的延迟或错误,那么您真的需要所有这些数据吗?事情是这样的——你并不总是需要大量数据才能找到正确的洞察力。您只需要正确的数据采样。
在这里插入图片描述

The idea behind sampling is to control the spans you send to your observability backend, resulting in lower ingest costs. Different organizations will have their own reasons for not just why they want to sample, but also what they want to sample. You might want to customize your sampling strategy to:
采样的核心思想是控制您发送到可观测后端的Span,从而降低摄取成本。不同的组织不仅有自己的采样原因,而且也有自己想要采样的对象。您可能需要自定义采样策略以实现以下目标:

  • Manage costs: If you have a high volume of telemetry, you risk incurring heavy charges from a telemetry backend vendor or cloud provider to export and store every span.
    管理成本:如果您有大量遥测数据,则可能会因导出和存储每个Span数据,而被遥测后端供应商或云提供商收取高额费用。
  • Focus on interesting traces: For example, your frontend team may only want to see traces with specific user attributes.
    关注有趣的Trace:例如,您的前端团队可能只想查看具有特定用户属性的Trace。
  • Filter out noise: For example, you may want to filter out health checks.
    过滤噪音:例如,您可能想要过滤掉健康检查。

Terminology

术语

It’s important to use consistent terminology when discussing sampling. A trace or span is considered “sampled” or “not sampled”:
在讨论采样时使用一致的术语非常重要。Trace或Span被视为“已采样”或“未采样”:

  • Sampled: A trace or span is processed and exported. Because it is chosen by the sampler as a representative of the population, it is considered “sampled”.
    已采样:处理并导出Trace或Span。因为它是由采样器选择作为总体的代表,所以它被认为是“已采样”。
  • Not sampled: A trace or span is not processed or exported. Because it is not chosen by the sampler, it is considered “not sampled”.
    未采样:未处理或未导出的Trace或Span。因为它不是由采样器选择的,所以被认为是“未采样”。

Sometimes, the definitions of these terms get mixed up. You may find someone state that they are “sampling out data” or that data not processed or exported is considered “sampled”. These are incorrect statements.
有时,这些术语的定义会混淆。您可能会发现有人声称他们正在“采样数据”,比如未处理或导出的数据被视为“采样”。这些都是不正确的说法。

Head Sampling

头部采样

Head sampling is a sampling technique used to make a sampling decision as early as possible. A decision to sample or drop a span or trace is not made by inspecting the trace as a whole.
头部采样是一种用于尽早做出采样决定的采样技术。对Span或Trace进行采样或删除的决定不是通过检查整个Trace来做出的。

For example, the most common form of head sampling is Consistent Probability Sampling. It may also be referred to as Deterministic Sampling. In this case, a sampling decision is made based on the trace ID and a desired percentage of traces to sample. This ensures that whole traces are sampled - no missing spans - at a consistent rate, such as 5% of all traces.
例如,最常见的头部采样形式是 一致概率采样。它也可以称为确定性采样。在这种情况下,采样决策是根据Trace ID和所需的采样Trace百分比做出的。这可确保对整个Trace保持一致的速率(例如所有Trace的 5%)进行采样,且不会丢失Span。

The upsides to head sampling are:
头部采样的优点是:

  • Easy to understand
    容易明白
  • Easy to configure
    易于配置
  • Efficient
    高效的
  • Can be done at any point in the trace collection pipeline
    可以在Trace收集流程中的任何阶段完成

The primary downside to head sampling is that it is not possible make a sampling decision based on data in the entire trace. This means that head sampling is effective as a blunt instrument, but is wholly insufficient for sampling strategies that must take whole-system information into account. For example, it is not possible to use head sampling to ensure that all traces with an error within them are sampled. For this, you need Tail Sampling.
头部采样的主要缺点是无法根据整个Tace中的数据做出采样决策。这意味着首部采样在某种程度上会有效,但对于必须考虑整个系统信息的采样策略来说完全不够。例如,不可能使用头部采样来确保对其中有错误的所有Trace进行采样。为此,您需要尾部采样。

Tail Sampling

尾部取样

Tail sampling is where the decision to sample a trace takes place by considering all or most of the spans within the trace. Tail Sampling gives you the option to sample your traces based on specific criteria derived from different parts of a trace, which isn’t an option with Head Sampling.
尾部采样是通过考虑Trace内的全部或大部分Span来决定对Trace哪些地方的Span进行采样的方法。尾部采样允许您根据Trace的不同部分派生出的特定条件对Trace进行采样,而头部采样则无法提供此选项。

在这里插入图片描述
Some examples of how you can use Tail Sampling include:
使用尾部采样的一些示例包括:

  • Always sampling traces that contain an error
    始终对包含错误的Trace进行采样
  • Sampling traces based on overall latency
    基于总体延迟的的Trace采样
  • Sampling traces based on the presence or value of specific attributes on one or more spans in a trace; for example, sampling more traces originating from a newly deployed service
    根据Trace中一个或多个Span上特定属性的存在与否或值对Trace进行采样;例如,对源自新部署的服务的更多Trace进行采样
  • Applying different sampling rates to traces based on certain criteria
    根据某些条件对Trace采用不同的采样率

As you can see, tail sampling allows for a much higher degree of sophistication. For larger systems that must sample telemetry, it is almost always necessary to use Tail Sampling to balance data volume with usefulness of that data.
正如您所看到的,尾部采样可以实现更高程度的复杂性。对于必须对Telemetry数据进行采样的大型系统,几乎总是需要使用尾部采样来平衡数据量和数据的有用性。

There are three primary downsides to tail sampling today:
目前尾部采样存在三个主要缺点:

  • Tail sampling can be difficult to implement. Depending on the kind of sampling techniques available to you, it is not always a “set and forget” kind of thing. As your systems change, so too will your sampling strategies. For a large and sophisticated distributed system, rules that implement sampling strategies can also be large and sophisticated.
    尾部采样可能很难实现。根据您可用的采样技术类型,它并不总是“设置后忘记”的事情。随着您的系统发生变化,您的采样策略也会发生变化。对于大型且复杂的分布式系统,实现采样策略的规则也可能庞大且复杂。
  • Tail sampling can be difficult to operate. The component(s) that implement tail sampling must be stateful systems that can accept and store a large amount of data. Depending on traffic patterns, this can require dozens or even hundreds of nodes that all utilize resources differently. Furthermore, a tail sampler may need to “fall back” to less computationally-intensive sampling techniques if it is unable to keep up with the volume of data it is receiving. Because of these factors, it is critical to monitor tail sampling components to ensure that they have the resources they need to make the correct sampling decisions.
    尾部取样可能很难操作。实现尾部采样的组件必须是可以接受和存储大量数据的有状态系统。根据流量模式,这可能需要数十个甚至数百个节点,这些节点都以不同的方式利用资源。此外,如果尾部采样器无法跟上正在接收的数据量,则可能需要“回退”到计算强度较低的采样技术。由于这些因素,监控尾部采样组件以确保它们拥有做出正确采样决策所需的资源至关重要。
  • Tail samplers often end up being in the domain of vendor-specific technology today. If you’re using a paid vendor for Observability, the most effective tail sampling options available to you may be limited to what the vendor offers.
    如今,尾部采样器通常最终属于特定于供应商的技术领域。如果您使用付费供应商来实现可观测性,那么您可用的最有效的尾部采样选项可能仅限于该供应商提供的选项。

Finally, for some systems, tail sampling may be used in conjunction with Head Sampling. For example, a set of services that produce an extremely high volume of trace data may first use head sampling to only sample a small percentage of traces, and then later in the telemetry pipeline use tail sampling to make more sophisticated sampling decisions before exporting to a backend. This is often done in the interest of protecting the telemetry pipeline from being overloaded.
最后,对于某些系统,尾部采样可以与头部采样结合使用。例如,生成大量跟踪数据的一组服务可能首先使用头部采样仅对一小部分跟踪进行采样,然后在Telemetry管道中使用尾部采样做出更复杂的采样决策,然后再导出到后端。这样做通常是为了防止Telemetry管道过载。

Support

Collector

The OpenTelemetry Collector includes the following sampling processors:
OpenTelemetry Collector 包括以下采样处理器:

  • Probabilistic Sampling Processor
    概率采样处理器
  • Tail Sampling Processor
    尾部采样处理器

Language SDKs

For the individual language specific implementations of the OpenTelemetry API & SDK you will find support for sampling at the respective documentation pages:
对于 OpenTelemetry API 和 SDK 的各个语言特定实现,您可以在相应的文档页面找到采样支持:

  • Erlang/Elixir
  • Go
  • JavaScript
  • Ruby

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/550460.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

CentOS下gitlab迁移和升级_gitlab备份的可以通用centos和 ubuntu吗(1)

先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前阿里P7 深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞…

机器学习方法在测井解释上的应用-以岩性分类为例

机器学习在测井解释上的应用越来越广泛,主要用于提高油气勘探和开发的效率和精度。通过使用机器学习算法,可以从测井数据中自动识别地质特征,预测岩石物理性质,以及优化油气储层的评估和管理。 以下是机器学习在测井解释中的一些…

OpenHarmony开发案例:【分布式遥控器】

1.概述 目前家庭电视机主要通过其自带的遥控器进行操控,实现的功能较为单一。例如,当我们要在TV端搜索节目时,电视机在遥控器的操控下往往只能完成一些字母或数字的输入,而无法输入其他复杂的内容。分布式遥控器将手机的输入能力…

5-pytorch-torch.nn.Sequential()快速搭建神经网络

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言torch.nn.Sequential()快速搭建网络法1 生成数据2 快速搭建网络3 训练、输出结果 总结 前言 本文内容还是基于4-pytorch前馈网络简单(分类&#xf…

滤波器笔记(杂乱)

线性相位是时间平移,相位不失真 零、基础知识 1、用相量表示正弦量 https://zhuanlan.zhihu.com/p/345546880 https://www.zhihu.com/question/347763932/answer/1103938667 A s i n ( ω t θ ) ⇔ A e j θ ⇔ A ∠ θ Asin(\omega t\theta) {\Leftrightarrow…

IBM SPSS Statistics for Mac中文激活版:强大的数据分析工具

IBM SPSS Statistics for Mac是一款功能强大的数据分析工具,为Mac用户提供了高效、精准的数据分析体验。 IBM SPSS Statistics for Mac中文激活版下载 该软件拥有丰富的统计分析功能,无论是描述性统计、推论性统计,还是高级的多元统计分析&am…

企业邮箱迁移是什么?如何通过IMAP/POP协议进行邮箱迁移?

使用公司邮箱工作的过程中,公司可能遇到公司规模的扩大或技术架构升级,可能要换公司邮箱。假如马上使用新的公司邮箱,业务处理要被终断。企业邮箱转移是公司更换邮箱不可或缺的一步,不仅是技术操作,更是企业信息安全、…

Unity MySql安装部署与Unity连接 下篇

一、前言 上篇讲到了如何安装与部署本地MySql;本篇主要讲Unity与MySql连接、创建表、删除表,然后就是对表中数据的增、删、改、查等操作。再讲这些之前会说一些安装MySql碰到的一些问题和Unity连接的问题。 当把本地MySql部署好之后,我们可能…

Pytorch搭建GoogleNet神经网络

一、创建卷积模板文件 因为每次使用卷积层都需要调用Con2d和relu激活函数,每次都调用非常麻烦,就将他们打包在一起写成一个类。 in_channels:输入矩阵深度作为参数输入 out_channels: 输出矩阵深度作为参数输入 经过卷积层和relu激活函数…

AI:156-利用Python进行自然语言处理(NLP):情感分析与文本分类

本文收录于专栏:精通AI实战千例专栏合集 从基础到实践,深入学习。无论你是初学者还是经验丰富的老手,对于本专栏案例和项目实践都有参考学习意义。 每一个案例都附带关键代码,详细讲解供大家学习,希望可以帮到大家。正…

JDK5.0新特性

目录 1、JDK5特性 1.1、静态导入 1.2 增强for循环 1.3 可变参数 1.4 自动装箱/拆箱 1.4.1 基本数据类型包装类 1.5 枚举类 1.6 泛型 1.6.1 泛型方法 1.6.2 泛型类 1.6.3 泛型接口 1.6.4 泛型通配符 1、JDK5特性 JDK5中新增了很多新的java特性,利用这些新…

你的RPCvs佬的RPC

一、课程目标 了解常见系统库的hook了解frida_rpc 二、工具 教程Demo(更新)jadx-guiVS CodejebIDLE 三、课程内容 1.Hook_Libart libart.so: 在 Android 5.0(Lollipop)及更高版本中,libart.so 是 Android 运行时(ART&#x…

计算机网络----第十二天

交换机端口安全技术和链路聚合技术 1、端口隔离技术: 用于在同vlan内部隔离用户; 同一隔离组端口不能通讯,不同隔离组端口可以通讯; 2、链路聚合技术: 含义:把连接到同一台交换机的多个物理端口捆绑为一个逻辑端口…

【前后端的那些事】SpringBoot 基于内存的ip访问频率限制切面(RateLimiter)

文章目录 1. 什么是限流2. 常见的限流策略2.1 漏斗算法2.2 令牌桶算法2.3 次数统计 3. 令牌桶代码编写4. 接口测试5. 测试结果 1. 什么是限流 限流就是在用户访问次数庞大时,对系统资源的一种保护手段。高峰期,用户可能对某个接口的访问频率急剧升高&am…

十大排序——6.插入排序

这篇文章我们来介绍一下插入排序 目录 1.介绍 2.代码实现 3.总结与思考 1.介绍 插入排序的要点如下所示: 首先将数组分为两部分[ 0 ... low-1 ],[ low ... arr.length-1 ],然后,我们假设左边[ 0 ... low-1 ]是已排好序的部分…

Spring Boot 多环境配置:YML 文件的三种高效方法

🌟 前言 欢迎来到我的技术小宇宙!🌌 这里不仅是我记录技术点滴的后花园,也是我分享学习心得和项目经验的乐园。📚 无论你是技术小白还是资深大牛,这里总有一些内容能触动你的好奇心。🔍 &#x…

力扣:141. 环形链表

力扣:141. 环形链表 给你一个链表的头节点 head ,判断链表中是否有环。 如果链表中有某个节点,可以通过连续跟踪 next 指针再次到达,则链表中存在环。 为了表示给定链表中的环,评测系统内部使用整数 pos 来表示链表尾…

uni-app学习

目录 一、安装HBuilderX 二、创第一个uni-app 三、项目目录和文件作用 四、全局配置文件(pages.json) 4.1 globalStyle(全局样式) 导航栏:背景颜色、标题颜色、标题文本 导航栏:开启下拉刷新、下拉背…

LeetCode 409—— 最长回文串

阅读目录 1. 题目2. 解题思路3. 代码实现 1. 题目 2. 解题思路 要想组成回文串,那么只有最中间的字符可以是奇数个,其余字符都必须是偶数个。 所以,我们先遍历一遍字符串,统计出每个字符出现的次数。 然后如果某个字符出现了偶…

【数据分享】历次人口普查数据(一普到七普)

国之情,民之意,查人口,定大计。 第七次人口普查已经结束,那么,为了方便大家把七普数据与之前的数据做对比,地理遥感生态网整理了从一普到七普人口数据,并且把第七次人口普查的数据也一并分享给…