-
Notifications
You must be signed in to change notification settings - Fork 782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenTelemetryLoggerOptions.IncludeScopes does not add scopes to logs #5678
Comments
Could you remove AzureMonitor part and see if it reproes with OTel SDK and Console Exporter? |
If I remove Azure Monitor, I do see scopes in the console output. info: TestService[0]
Getting stuff
TestService: Information: Getting stuff
LogRecord.Timestamp: 2024-06-07T23:26:11.5309790Z
LogRecord.TraceId: c4949647becdb3ff363b3bbc18cadae0
LogRecord.SpanId: 8c438e4b3ffe7f4b
LogRecord.TraceFlags: None
LogRecord.CategoryName: TestService
LogRecord.Severity: Info
LogRecord.SeverityText: Information
LogRecord.FormattedMessage: Getting stuff
LogRecord.Body: Getting stuff
LogRecord.Attributes (Key:Value):
OriginalFormat (a.k.a Body): Getting stuff
++LogRecord.ScopeValues (Key:Value):
++[Scope.0]:SpanId: 8c438e4b3ffe7f4b
++[Scope.0]:TraceId: c4949647becdb3ff363b3bbc18cadae0
++[Scope.0]:ParentId: 0000000000000000
++[Scope.1]:ConnectionId: 0HN4794RP0BEC
++[Scope.2]:RequestId: 0HN4794RP0BEC:00000001
++[Scope.2]:RequestPath: /
++[Scope.3]:test: abc
Resource associated with LogRecord:
telemetry.sdk.name: opentelemetry
telemetry.sdk.language: dotnet
telemetry.sdk.version: 1.8.1
service.name: unknown_service:asp-logging |
@mtaron Thanks for confirming. I'd recommend to report this issue to AzureMonitor repo, as adding AzureMonitor seems to affect other exporters 😞 |
I searched GitHub for "azure monitor" and didn't find a repo. It it an internal Microsoft repo? It looks like you work on both OpenTelemetry and Azure Monitor -- could you transfer this issue to the correct repository? |
Sorry I missed to share the actual repo! You can consult : https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-enable?tabs=aspnetcore#support as well. https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/monitor - This is the place where AzureMonitor exporter/distro is hosted, and you can report the issue in that repo. I cannot "transfer" this issue, as Github transfer only works for repos under same organization, and AzureMonitor exporter is not under OpenTelemetry repo! So you have to create a new issue in the above repo. |
Thanks for the links! Filed Azure/azure-sdk-for-net#44480 |
Package
OpenTelemetry
Package Version
Runtime Version
net8.0
Description
I expect when
OpenTelemetryLoggerOptions.IncludeScopes = true
that scopes would be included on logs. However, the scopes do not appear in either the console exporter, or Azure Monitor.Steps to Reproduce
dotnet new web
dotnet add package Azure.Monitor.OpenTelemetry.AspNetCore && dotnet add package OpenTelemetry.Exporter.Console
Program.cs
and run (add a valid connection string for app insights)Expected Result
I expect to see "test": "abc" as a customDimensions in app insights and to show up in the console output as well.
Actual Result
The scope values do not show up in Application Insights or the console logs.
Additional Context
No response
The text was updated successfully, but these errors were encountered: