Soru

Zorluk: KolayConfigure Application Insights Instrumentation and Telemetry

You are configuring Application Insights instrumentation for an ASP.NET Core web application that will be hosted on Azure App Service. You want to ensure telemetry data is collected and sent to Azure Monitor. Which two of the following configuration actions are required to achieve this?

  1. Register the telemetry services by calling builder.Services.AddApplicationInsightsTelemetry(builder.Configuration) in Program.cs.Cevap
  2. Set the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable in your App Service configuration.Cevap
  3. C
    Instantiate TelemetryClient directly in your controllers without defining a connection string or registering the telemetry services.
  4. D
    Create and run a Kusto Query Language (KQL) query omitting the time range filter in order to trigger the telemetry engine.

Cevap

To configure Application Insights instrumentation, you must register the telemetry services in your application's startup file and specify the Application Insights connection string in the configuration settings.
Registering the services in Program.cs ensures the SDK captures built-in telemetry, and setting the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable instructs the SDK where to send the telemetry.

Adım Adım Çözüm

1
Register telemetry services in the Program.cs file.
The application runtime registers dependency injection services required for telemetry auto-collection and custom logging.
Registering the SDK in the startup services enables automatic dependency, request, and exception tracking.
2
Set the APPLICATIONINSIGHTS_CONNECTION_STRING in the environment variables or configuration.
The SDK retrieves the connection string to determine the ingestion endpoint and routing details.
Providing the connection string is mandatory for routing telemetry data to the correct Application Insights resource.

Anahtar Kavram

Successful Application Insights SDK setup requires registering the telemetry services in code and providing a connection string for routing.
Bu soruyu puanla