Soru

Zorluk: OrtaConfigure Application Insights Web Tests and Availability Monitoring

You are configuring a custom availability monitoring tool that runs as a continuous background process on an internal server. The tool executes health checks and uses the Azure Application Insights SDK to report results. You use the following class to send telemetry:

csharp
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.DataContracts;

public class HealthReporter
{
private static TelemetryClient telemetryClient = new TelemetryClient();

public static void SendResult(bool success)
{
var availability = new AvailabilityTelemetry
{
Name = "InternalApiTest",
Success = success,
RunLocation = "CorporateNetwork"
};
telemetryClient.TrackAvailability(availability);
}
}

Although the background process runs continuously and calls the `SendResult` method, no availability data appears in the Azure Portal, and no exceptions are logged locally.

Which of the following is the most likely cause of this issue?

  1. A
    The availability telemetry payload size exceeds the 64 KB maximum message limit, causing the ingestion endpoint to reject it.
  2. B
    The application is using a system-assigned managed identity, but must use a user-assigned managed identity to write custom availability telemetry.
  3. The connection string for the Application Insights resource was not configured, causing the SDK to silently drop the telemetry.Cevap
  4. D
    The service principal used by the background process lacks the GET permission in the Azure Key Vault access policy.

Cevap

The connection string for the Application Insights resource was not configured, causing the SDK to silently drop the telemetry.
The correct answer explains that the connection string was not configured. The TelemetryClient requires a destination to route telemetry. When no connection string is set, the SDK drops the data silently to prevent application crashes.

Adım Adım Çözüm

1
Analyze the initialization of the TelemetryClient in the code snippet.
The code uses `new TelemetryClient()` without passing an explicit configuration.
This initialization relies on the default TelemetryConfiguration, which must resolve the connection string from environment variables or local configuration files.
2
Evaluate the SDK behavior when the target endpoint/connection string is missing.
Without a valid connection string, the SDK behaves in a loop-back/no-op mode, dropping the telemetry.
This design choice prevents monitoring configuration issues from breaking core application runtime execution.

Anahtar Kavram

Application Insights SDK Configuration and Telemetry Ingestion Requirements
Bu soruyu puanla