Skip to content

Commit bf7619f

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 e1d152e commit bf7619f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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)