Home > Enterprise >  Azure WebJobs - How to disable adaptive sampling for application insights?
Azure WebJobs - How to disable adaptive sampling for application insights?

Time:12-01

I came across enter image description here

Is it possible to disable adaptive sampling?

Any help is much appreciated. Thank you!

CodePudding user response:

Simplest way is to set the SamplingSettings property to null:

.ConfigureLogging((loggingContext, builder) =>
{
    builder.AddConsole();
    builder.AddApplicationInsightsWebJobs(o =>
    {
        o.SamplingSettings = null;
    });
})

This prevents the AdaptiveSamplingTelemetryProcessor being added to the list of telemetry processors.

You can inspect whether adaptive sampling is active or not by taking a look at the TelemetryClient.TelemetryConfiguration.TelemetryProcessors property to see whether it contains an entry of type AdaptiveSamplingTelemetryProcessor or not.

CodePudding user response:

Is it possible to disable adaptive sampling?

You can disable Adaptive Sampling by going into the ApplicationInsights.config file, and remove or comment the AdaptiveSamplingTelemetryProcessor node.

<TelemetryProcessors>

<!-- Disable adaptive sampling:
  <Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
    <MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
  </Add>
-->
  • Related