-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Open
Labels
⌚ Not TriagedNot triagedNot triageddotnet-fundamentals/svcin-prThis issue will be closed (fixed) by an active pull request.This issue will be closed (fixed) by an active pull request.
Description
Type of issue
Code doesn't work
Description
There is a small issue in the article which prevents the sample code from working.
In step two the following code is added:
if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
{
otel.UseAzureMonitor();
}In step three it's recommended to add the following json to appsettings.json:
"AzureMonitor": {
"ConnectionString": "InstrumentationKey=12345678-abcd-abcd-abcd-12345678..."
}Because of this otel.UseAzureMonitor(); is never called.
An easy fix would be to update code in step 2 as so:
if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"] ?? builder.Configuration["AzureMonitor:ConnectionString"]))
{
otel.UseAzureMonitor();
}or something similar.
Thank you!
Page URL
https://learn.microsoft.com/en-us/dotnet/core/diagnostics/observability-applicationinsights
Content source URL
Document Version Independent Id
e14803f7-d5c7-657a-763c-680cf4197365
Article author
Metadata
- ID: 45cce027-ad78-e3d1-7144-6091a9b5f023
- Service: dotnet-fundamentals
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
⌚ Not TriagedNot triagedNot triageddotnet-fundamentals/svcin-prThis issue will be closed (fixed) by an active pull request.This issue will be closed (fixed) by an active pull request.