Skip to content
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

Adding an override to LoggerProvider.GetLogger #6132

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,0 +1,2 @@
OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net8.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net8.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net8.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net8.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net8.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04-arm, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04-arm, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04-arm, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04-arm, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04-arm, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net9.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 1 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Symbol 'OpenTelemetry.Logs.Logger.Attributes.get -> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>?' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)
OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net8.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net8.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net8.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net8.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04, net8.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04-arm, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04-arm, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04-arm, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04-arm, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (ubuntu-22.04-arm, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / validate-packages / run-package-validation-stable

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net462)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net9.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 2 in src/OpenTelemetry.Api/.publicApi/Stable/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build-test-project-stable / build-test (windows-latest, net8.0)

Symbol 'OpenTelemetry.Logs.LoggerProvider.GetLogger(string? name, string? version, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? attributes) -> OpenTelemetry.Logs.Logger!' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)
9 changes: 8 additions & 1 deletion src/OpenTelemetry.Api/Logs/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ protected Logger(string? name)
/// </summary>
public string? Version { get; private set; }

/// <summary>
/// Gets the attributes of the instrumentation library.
/// </summary>
public IEnumerable<KeyValuePair<string, object?>>? Attributes { get; private set; }

/// <summary>
/// Emit a log.
/// </summary>
Expand All @@ -63,8 +68,10 @@ public abstract void EmitLog(
in LogRecordAttributeList attributes);

internal void SetInstrumentationScope(
string? version)
string? version,
IEnumerable<KeyValuePair<string, object?>>? attributes)
{
this.Version = version;
this.Attributes = attributes;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are going to do this we need to take a copy here so they can't be mutated after being set.

Same idea as here, which also sorts:

https://github.com/dotnet/runtime/blob/fcd9339f16500a4954d84e9d0d93a99e84b08987/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivitySource.cs#L42-L49

}
}
25 changes: 22 additions & 3 deletions src/OpenTelemetry.Api/Logs/LoggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected LoggerProvider()
internal
#endif
Logger GetLogger()
=> this.GetLogger(name: null, version: null);
=> this.GetLogger(name: null, version: null, attributes: null);

#if EXPOSE_EXPERIMENTAL_FEATURES
/// <summary>
Expand All @@ -55,7 +55,7 @@ Logger GetLogger()
internal
#endif
Logger GetLogger(string? name)
=> this.GetLogger(name, version: null);
=> this.GetLogger(name, version: null, attributes: null);

#if EXPOSE_EXPERIMENTAL_FEATURES
/// <summary>
Expand All @@ -73,13 +73,32 @@ Logger GetLogger(string? name)
internal
#endif
Logger GetLogger(string? name, string? version)
=> this.GetLogger(name, version, attributes: null);

#if EXPOSE_EXPERIMENTAL_FEATURES
/// <summary>
/// Gets a logger with the given name and version.
/// </summary>
/// <remarks><inheritdoc cref="Logger" path="/remarks"/></remarks>
/// <param name="name">Optional name identifying the instrumentation library.</param>
/// <param name="version">Optional version of the instrumentation library.</param>
/// <param name="attributes">Optional instrumentation scope attributes.</param>
/// <returns><see cref="Logger"/> instance.</returns>
#if NET
[Experimental(DiagnosticDefinitions.LogsBridgeExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)]
#endif
public
#else
internal
#endif
Logger GetLogger(string? name, string? version, IEnumerable<KeyValuePair<string, object?>>? attributes)
{
if (!this.TryCreateLogger(name, out var logger))
{
return NoopLogger;
}

logger!.SetInstrumentationScope(version);
logger!.SetInstrumentationScope(version, attributes);

return logger;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,96 @@ internal static int WriteScopeLogs(byte[] buffer, int writePosition, SdkLimitOpt
int resourceLogsScopeLogsLengthPosition = writePosition;
writePosition += ReserveSizeForLength;

writePosition = WriteScopeLog(buffer, writePosition, sdkLimitOptions, experimentalOptions, entry.Value[0].Logger.Name, entry.Value);
writePosition = WriteScopeLog(buffer, writePosition, sdkLimitOptions, experimentalOptions, entry.Value[0].Logger, entry.Value);
ProtobufSerializer.WriteReservedLength(buffer, resourceLogsScopeLogsLengthPosition, writePosition - (resourceLogsScopeLogsLengthPosition + ReserveSizeForLength));
}
}

return writePosition;
}

internal static int WriteScopeLog(byte[] buffer, int writePosition, SdkLimitOptions sdkLimitOptions, ExperimentalOptions experimentalOptions, string loggerName, List<LogRecord> logRecords)
internal static int WriteScopeLog(byte[] buffer, int writePosition, SdkLimitOptions sdkLimitOptions, ExperimentalOptions experimentalOptions, Logger logger, List<LogRecord> logRecords)
{
var value = loggerName.AsSpan();
var numberOfUtf8CharsInString = ProtobufSerializer.GetNumberOfUtf8CharsInString(value);
var serializedLengthSize = ProtobufSerializer.ComputeVarInt64Size((ulong)numberOfUtf8CharsInString);
var value = logger.Name.AsSpan();

writePosition = ProtobufSerializer.WriteTag(buffer, writePosition, ProtobufOtlpLogFieldNumberConstants.ScopeLogs_Scope, ProtobufWireType.LEN);
int instrumentationScopeLengthPosition = writePosition;
writePosition += ReserveSizeForLength;

writePosition = ProtobufSerializer.WriteStringWithTag(buffer, writePosition, ProtobufOtlpCommonFieldNumberConstants.InstrumentationScope_Name, value);

if (logger.Version != null)
{
writePosition = ProtobufSerializer.WriteStringWithTag(buffer, writePosition, ProtobufOtlpCommonFieldNumberConstants.InstrumentationScope_Version, logger.Version);
}

if (logger.Attributes != null)
{
var maxAttributeCount = sdkLimitOptions.LogRecordAttributeCountLimit ?? int.MaxValue;
var maxAttributeValueLength = sdkLimitOptions.LogRecordAttributeValueLengthLimit ?? int.MaxValue;
ProtobufOtlpTagWriter.OtlpTagWriterState otlpTagWriterState = new ProtobufOtlpTagWriter.OtlpTagWriterState
{
Buffer = buffer,
WritePosition = writePosition,
TagCount = 0,
DroppedTagCount = 0,
};

if (logger.Attributes is IReadOnlyList<KeyValuePair<string, object?>> attributes)
{
for (int i = 0; i < attributes.Count; i++)
{
if (otlpTagWriterState.TagCount < maxAttributeCount)
{
otlpTagWriterState.WritePosition = ProtobufSerializer.WriteTag(otlpTagWriterState.Buffer, otlpTagWriterState.WritePosition, ProtobufOtlpCommonFieldNumberConstants.InstrumentationScope_Attributes, ProtobufWireType.LEN);
int instrumentationScopeAttributesLengthPosition = otlpTagWriterState.WritePosition;
otlpTagWriterState.WritePosition += ReserveSizeForLength;

ProtobufOtlpTagWriter.Instance.TryWriteTag(ref otlpTagWriterState, attributes[i].Key, attributes[i].Value, maxAttributeValueLength);

var instrumentationScopeAttributesLength = otlpTagWriterState.WritePosition - (instrumentationScopeAttributesLengthPosition + ReserveSizeForLength);
ProtobufSerializer.WriteReservedLength(otlpTagWriterState.Buffer, instrumentationScopeAttributesLengthPosition, instrumentationScopeAttributesLength);
otlpTagWriterState.TagCount++;
}
else
{
otlpTagWriterState.DroppedTagCount++;
}
}
}
else
{
foreach (var attribute in logger.Attributes)
{
if (otlpTagWriterState.TagCount < maxAttributeCount)
{
otlpTagWriterState.WritePosition = ProtobufSerializer.WriteTag(otlpTagWriterState.Buffer, otlpTagWriterState.WritePosition, ProtobufOtlpCommonFieldNumberConstants.InstrumentationScope_Attributes, ProtobufWireType.LEN);
int instrumentationScopeAttributesLengthPosition = otlpTagWriterState.WritePosition;
otlpTagWriterState.WritePosition += ReserveSizeForLength;

ProtobufOtlpTagWriter.Instance.TryWriteTag(ref otlpTagWriterState, attribute.Key, attribute.Value, maxAttributeValueLength);

var instrumentationScopeAttributesLength = otlpTagWriterState.WritePosition - (instrumentationScopeAttributesLengthPosition + ReserveSizeForLength);
ProtobufSerializer.WriteReservedLength(otlpTagWriterState.Buffer, instrumentationScopeAttributesLengthPosition, instrumentationScopeAttributesLength);
otlpTagWriterState.TagCount++;
}
else
{
otlpTagWriterState.DroppedTagCount++;
}
}
}

if (otlpTagWriterState.DroppedTagCount > 0)
{
otlpTagWriterState.WritePosition = ProtobufSerializer.WriteTag(buffer, otlpTagWriterState.WritePosition, ProtobufOtlpCommonFieldNumberConstants.InstrumentationScope_Dropped_Attributes_Count, ProtobufWireType.VARINT);
otlpTagWriterState.WritePosition = ProtobufSerializer.WriteVarInt32(buffer, otlpTagWriterState.WritePosition, (uint)otlpTagWriterState.DroppedTagCount);
}

writePosition = otlpTagWriterState.WritePosition;
}

// numberOfUtf8CharsInString + tagSize + length field size.
writePosition = ProtobufSerializer.WriteTagAndLength(buffer, writePosition, numberOfUtf8CharsInString + 1 + serializedLengthSize, ProtobufOtlpLogFieldNumberConstants.ScopeLogs_Scope, ProtobufWireType.LEN);
writePosition = ProtobufSerializer.WriteStringWithTag(buffer, writePosition, ProtobufOtlpCommonFieldNumberConstants.InstrumentationScope_Name, numberOfUtf8CharsInString, value);
ProtobufSerializer.WriteReservedLength(buffer, instrumentationScopeLengthPosition, writePosition - (instrumentationScopeLengthPosition + ReserveSizeForLength));

for (int i = 0; i < logRecords.Count; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,94 @@ public void LogSerialization_ExpandsBufferForLogsAndSerializes()
Assert.Equal("MyLogger", request.ResourceLogs[0].ScopeLogs[0].Scope?.Name);
}

[Theory]
[InlineData(true, true)]
[InlineData(true, false)]
[InlineData(false, true)]
[InlineData(false, false)]
public void InstrumentationScopeVersionAndAttributesAreExported(bool includeVersion, bool includeAttributes)
{
var version = "1.0.0";
var loggerName = "MyLogger";

var instrumentationScopeAttributes = new List<KeyValuePair<string, object?>>
{
new("a", "x"),
new("b", 1),
new("c", true),
};

var logRecords = new List<LogRecord>();

using (var loggerProvider = Sdk.CreateLoggerProviderBuilder()
.AddInMemoryExporter(logRecords)
.Build())
{
Logger? logger;

if (includeVersion && includeAttributes)
{
logger = loggerProvider.GetLogger(loggerName, version, instrumentationScopeAttributes);
}
else if (includeVersion && !includeAttributes)
{
logger = loggerProvider.GetLogger(loggerName, version);
}
else if (!includeVersion && includeAttributes)
{
logger = loggerProvider.GetLogger(loggerName, null, instrumentationScopeAttributes);
}
else
{
logger = loggerProvider.GetLogger(loggerName);
}

logger.EmitLog(new LogRecordData());
}

Assert.Single(logRecords);

var batch = new Batch<LogRecord>(logRecords.ToArray(), logRecords.Count);
var resourceBuilder = ResourceBuilder.CreateEmpty();

OtlpCollector.ExportLogsServiceRequest request = CreateLogsExportRequest(DefaultSdkLimitOptions, new ExperimentalOptions(), batch, resourceBuilder.Build());

Assert.Equal(loggerName, request.ResourceLogs[0].ScopeLogs[0].Scope?.Name);

if (includeVersion)
{
Assert.Equal(version, request.ResourceLogs[0].ScopeLogs[0].Scope?.Version);
}
else
{
Assert.Equal(string.Empty, request.ResourceLogs[0].ScopeLogs[0].Scope?.Version);
}

if (includeAttributes)
{
Assert.Equal(instrumentationScopeAttributes.Count, request.ResourceLogs[0].ScopeLogs[0].Scope?.Attributes.Count);

var index = 0;

Assert.Equal(instrumentationScopeAttributes[index].Key, request.ResourceLogs[0].ScopeLogs[0].Scope?.Attributes[index].Key);
Assert.Equal(instrumentationScopeAttributes[index].Value, request.ResourceLogs[0].ScopeLogs[0].Scope?.Attributes[index].Value.StringValue);

index++;

Assert.Equal(instrumentationScopeAttributes[index].Key, request.ResourceLogs[0].ScopeLogs[0].Scope?.Attributes[index].Key);
Assert.Equal(instrumentationScopeAttributes[index].Value, (int?)request.ResourceLogs[0].ScopeLogs[0].Scope?.Attributes[index].Value.IntValue);

index++;

Assert.Equal(instrumentationScopeAttributes[index].Key, request.ResourceLogs[0].ScopeLogs[0].Scope?.Attributes[index].Key);
Assert.Equal(instrumentationScopeAttributes[index].Value, request.ResourceLogs[0].ScopeLogs[0].Scope?.Attributes[index].Value.BoolValue);
}
else
{
Assert.Empty(request.ResourceLogs[0].ScopeLogs[0].Scope?.Attributes!);
}
}

private static void RunVerifyEnvironmentVariablesTakenFromIConfigurationTest(
string? optionsName,
Func<Action<IServiceCollection>, (IDisposable Container, ILoggerFactory LoggerFactory)> createLoggerFactoryFunc)
Expand Down
Loading