Show answerHide answer
Correct answer: B From the code repository of webapp1, modify the Startup.cs file.
Explanation
Explanation:This question involves configuring Application Insights telemetry sampling for a .NET Core web application. Sampling controls the volume of telemetry data sent to Application Insights to reduce costs and network traffic while preserving statistical accuracy. The requirement is to set a fixed sampling rate, which must be configured at the application code level in .NET Core applications, not through the portal settings.
Correct Option:
B. From the code repository of webapp1, modify the Startup.cs file.
In .NET Core applications, Application Insights configuration is done programmatically in code, not via XML configuration files.
The Startup.cs file's ConfigureServices method is where you configure services, including Application Insights telemetry with custom sampling settings.
You would add code to configure the TelemetryConfiguration with a FixedRateSampler to implement fixed sampling, typically by modifying the dependency injection setup for ApplicationInsightsServiceOptions.
Incorrect Option:
A. From the code repository of webapp1, modify the ApplicationInsights.config file:
This XML configuration file is used for ASP.NET (Full Framework) applications, not for .NET Core applications. .NET Core uses appsettings.json and code-based configuration in Startup.cs.
C. From AppInsights1, modify the Usage and estimated costs settings:
While you can enable or disable sampling from the portal's "Usage and estimated costs" blade, this configures adaptive sampling (which adjusts rate dynamically based on traffic), not fixed sampling. Also, portal settings affect data ingestion, not how the app sends data.
D. From AppInsights1, configure the Continuous export settings:
Continuous export is used to export telemetry data from Application Insights to Azure Storage for long-term retention or external processing. It has no relationship to controlling the sampling rate of data being sent from the application.
Reference:
Microsoft Learn - "Application Insights sampling for ASP.NET Core applications". The documentation specifies that for .NET Core apps, sampling must be configured in code during service configuration, typically in Startup.cs or Program.cs, using methods like AddApplicationInsightsTelemetry with customized options.