Currently what I did in startup class is:
services.AddApplicationInsightsTelemetryWorkerService(<MyAppInsightsInstrumentationKey>);
According to official example, to disable adaptive sampling we should pass the ApplicationInsightsServiceOptions to services.AddApplicationInsightsTelemetryWorkerService(): Link
using Microsoft.ApplicationInsights.WorkerService;
public void ConfigureServices(IServiceCollection services)
{
var aiOptions = new ApplicationInsightsServiceOptions();
// Disables adaptive sampling.
aiOptions.EnableAdaptiveSampling = false;
// Disables QuickPulse (Live Metrics stream).
aiOptions.EnableQuickPulseMetricStream = false;
services.AddApplicationInsightsTelemetryWorkerService(aiOptions);
}
Since I am already passing the instrumentationKey. What's the proper way to disable adaptive sampling in my case?
Find the answer: