Azure App见解,自适应采样包含的类型不起作用

问题描述 投票:1回答:1

我想采样仅将自适应采样应用于“ Dependency” itemType。我使用以下代码实现了这一目标,

builder.UseAdaptiveSampling(maxTelemetryItemsPerSecond: 250, includedTypes: "Dependency");

但是问题是,自适应采样将应用于所有itemType,而不仅仅是采样“ Dependency”。有人遇到过同样的问题吗?

azure-application-insights sampling telemetry
1个回答
0
投票

请看一下Configure sampling settings-> 重要部分,如下所示:

如果使用此方法配置采样,请确保在调用AddApplicationInsightsTelemetry()时将aiOptions.EnableAdaptiveSampling属性设置为false。

因此,请如下更改代码:

    //other code

    builder.UseAdaptiveSampling(maxTelemetryItemsPerSecond:250, includedTypes: "Dependency");

    //add the following code
    var aiOptions = new Microsoft.ApplicationInsights.AspNetCore.Extensions.ApplicationInsightsServiceOptions();
    aiOptions.EnableAdaptiveSampling = false;
    services.AddApplicationInsightsTelemetry(aiOptions);

    //other code
© www.soinside.com 2019 - 2024. All rights reserved.