Skip to content

Commit 6afb357

Browse files
Configures Azure Monitor connection string.
Specifies the Azure Monitor connection string directly in the OpenTelemetry configuration. This allows the application to connect to the correct Azure Monitor instance, which improves telemetry data routing.
1 parent 689e471 commit 6afb357

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

EssentialCSharp.Web/Program.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ private static void Main(string[] args)
5151

5252
if (!string.IsNullOrEmpty(appInsightsConnectionString))
5353
{
54-
builder.Services.AddOpenTelemetry().UseAzureMonitor();
54+
builder.Services.AddOpenTelemetry().UseAzureMonitor(
55+
options =>
56+
{
57+
options.ConnectionString = appInsightsConnectionString;
58+
});
5559
builder.Services.AddApplicationInsightsTelemetry();
5660
builder.Services.AddServiceProfiler();
5761
}

0 commit comments

Comments
 (0)