4

我想改用 Application Insights 进行日志记录等。我知道我需要对遥测数据使用采样,以保持在免费计划内。但是,我希望能够查看导致抛出异常的所有事件序列,以便重现它们。

Application Insights 是否带有这样的内置功能?如果没有,有什么方法可以编写一个自定义采样器来产生所需的行为?例如

class CustomSampler : ITelemetrySampler
4

1 回答 1

9

AdaptiveSamplingTelemetryProcessor 版本 2.2.0 中有 ExcludeTypes 属性。

<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
  <MaxTelemetryItemsPerSecond>499</MaxTelemetryItemsPerSecond>
  <ExcludedTypes>Exception</ExcludedTypes>
</Add>

来自 2.2.0-beta1 的发行说明

遥测类型可以通过指定 ExcludedTypes 属性从采样中排除(在 AdaptiveSampling 遥测处理器节点下添加 ExcludedTypes 元素,使用 ';' 分隔列表。可能的类型是“依赖”、“事件”、“异常”、“页面视图”、“请求” “, “痕迹”)。

https://github.com/Microsoft/ApplicationInsights-dotnet/blob/v2.2.0/src/TelemetryChannels/ServerTelemetryChannel/Shared/AdaptiveSamplingTelemetryProcessor.cs#L67

于 2017-01-11T19:14:50.960 回答