I think you can refer to this chapter
It mentioned that in asp.net core, we can disable the default adaptive sampling and set fixed-rate sampling by builder.UseSampling(fixedSamplingPercentage);
, and according to the sdk, we can also set include and exclude options
public static TelemetryProcessorChainBuilder UseSampling(this TelemetryProcessorChainBuilder builder, double samplingPercentage, string excludedTypes = null, string includedTypes = null);
my code here:
var configuration = app.ApplicationServices.GetService<TelemetryConfiguration>();
var builder = configuration.DefaultTelemetrySink.TelemetryProcessorChainBuilder;
// For older versions of the Application Insights SDK, use the following line instead:
// var builder = configuration.TelemetryProcessorChainBuilder;
// Using fixed rate sampling
double fixedSamplingPercentage = 10;
string excludedTypes = "Exception";
string includedTypes = "Request";
builder.UseSampling(fixedSamplingPercentage, excludedTypes, includedTypes);
builder.Build();
Each request here will lead to an exception in my test, and here's the application insights detail:
