Azure App Insights 抽样 (ItemCount)
Azure App Insights Sampling (ItemCount)
我对 Azure App Insights 采样有疑问。
如果日志项的 itemCount 字段大于 1,是否意味着存在完全相同的请求并且已被采样?
我的日志有一个请求发送了 itemCount = 2 的这条消息。并且这个请求以 OptimisticConcurrencyException 结束,所以我的事务已经回滚。在此交易中,我向第 3 方服务发送消息。
最有趣的是,他们告诉我他们从我的服务中收到了 2 条消息,并且我的数据库已更新(因此事务已提交)。
如果有 2 个请求,其中一个返回 200 个代码,另一个返回 500 个代码,那么一切都变得清楚了。但是应用程序洞察日志项 abot OptimisticConcurrencyException 的值 itemCount = 2,这意味着此异常被抛出两次(对于两个请求) .
此外,除此之外,我没有看到任何其他可以更改数据的请求,该请求正在更改。
谁能解释一下应用洞察如何对请求和错误进行采样?
这实际上取决于 how/where 您的采样发生情况,因为采样可能发生在 3 个不同的地方,具体取决于您如何配置您的应用程序。
有一个 fair amount of documentation about the various layers of sampling,但假设:
The sampling algorithm decides which telemetry items to drop, and which ones to keep (whether it's in the SDK or in the Application Insights service). The sampling decision is based on several rules that aim to preserve all interrelated data points intact, maintaining a diagnostic experience in Application Insights that is actionable and reliable even with a reduced data set. For example, if for a failed request your app sends additional telemetry items (such as exception and traces logged from this request), sampling will not split this request and other telemetry. It either keeps or drops them all together. As a result, when you look at the request details in Application Insights, you can always see the request along with its associated telemetry items.
更新:
我从进行抽样的团队成员那里得到了更多详细信息,它的工作方式如下:
- 采样率由应用中每秒发生的事件数决定
- AI SDK随机在请求开始时选择请求进行采样(所以不知道会不会失败还是成功)
- AI SDK分配
itemCount=<sampling ratio>
这将解释您看到的行为,当两个请求(成功 + 失败)被计为两次失败时:失败的请求被采样 "in",因此在遥测中,您有 2失败的请求(一个 itemCount=2 的请求)而不是一个失败的请求和一个成功的请求,因为成功的请求被采样掉了。
我对 Azure App Insights 采样有疑问。 如果日志项的 itemCount 字段大于 1,是否意味着存在完全相同的请求并且已被采样?
我的日志有一个请求发送了 itemCount = 2 的这条消息。并且这个请求以 OptimisticConcurrencyException 结束,所以我的事务已经回滚。在此交易中,我向第 3 方服务发送消息。 最有趣的是,他们告诉我他们从我的服务中收到了 2 条消息,并且我的数据库已更新(因此事务已提交)。 如果有 2 个请求,其中一个返回 200 个代码,另一个返回 500 个代码,那么一切都变得清楚了。但是应用程序洞察日志项 abot OptimisticConcurrencyException 的值 itemCount = 2,这意味着此异常被抛出两次(对于两个请求) . 此外,除此之外,我没有看到任何其他可以更改数据的请求,该请求正在更改。
谁能解释一下应用洞察如何对请求和错误进行采样?
这实际上取决于 how/where 您的采样发生情况,因为采样可能发生在 3 个不同的地方,具体取决于您如何配置您的应用程序。
有一个 fair amount of documentation about the various layers of sampling,但假设:
The sampling algorithm decides which telemetry items to drop, and which ones to keep (whether it's in the SDK or in the Application Insights service). The sampling decision is based on several rules that aim to preserve all interrelated data points intact, maintaining a diagnostic experience in Application Insights that is actionable and reliable even with a reduced data set. For example, if for a failed request your app sends additional telemetry items (such as exception and traces logged from this request), sampling will not split this request and other telemetry. It either keeps or drops them all together. As a result, when you look at the request details in Application Insights, you can always see the request along with its associated telemetry items.
更新: 我从进行抽样的团队成员那里得到了更多详细信息,它的工作方式如下:
- 采样率由应用中每秒发生的事件数决定
- AI SDK随机在请求开始时选择请求进行采样(所以不知道会不会失败还是成功)
- AI SDK分配
itemCount=<sampling ratio>
这将解释您看到的行为,当两个请求(成功 + 失败)被计为两次失败时:失败的请求被采样 "in",因此在遥测中,您有 2失败的请求(一个 itemCount=2 的请求)而不是一个失败的请求和一个成功的请求,因为成功的请求被采样掉了。