-
Notifications
You must be signed in to change notification settings - Fork 854
[sdk] Merge 1.5.1 fixes to main (1.6 dev) #4619
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ae03840
[sdk-1.5.0-hotfix] Fix LogRecord.State being null when TState matches…
CodeBlanch b03e031
[sdk-1.5.0-hotfix] Removed support for parsing custom log states usin…
CodeBlanch 8d61691
[sdk-1.5.0-hotfix] Update CHANGELOG for release (#4615)
CodeBlanch 012c08f
Merge 1.5.1 hotfix changes to main.
CodeBlanch 1cf54f1
Updates for 1.6 logging changes.
CodeBlanch 7af15f6
Test updates.
CodeBlanch 6a8fbaa
Merge branch 'main' into merge-1.5.1-fixes
CodeBlanch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,10 @@ | |
|
|
||
| ## Unreleased | ||
|
|
||
| ## 1.5.1 | ||
|
|
||
| Released 2023-Jun-26 | ||
|
|
||
| ## 1.5.0 | ||
|
|
||
| Released 2023-Jun-05 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,10 @@ | |
|
|
||
| ## Unreleased | ||
|
|
||
| ## 1.5.1 | ||
|
|
||
| Released 2023-Jun-26 | ||
|
|
||
| ## 1.5.0 | ||
|
|
||
| Released 2023-Jun-05 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,10 @@ | |
|
|
||
| ## Unreleased | ||
|
|
||
| ## 1.5.1 | ||
|
|
||
| Released 2023-Jun-26 | ||
|
|
||
| ## 1.5.0 | ||
|
|
||
| Released 2023-Jun-05 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,10 @@ | |
|
|
||
| ## Unreleased | ||
|
|
||
| ## 1.5.1 | ||
|
|
||
| Released 2023-Jun-26 | ||
|
|
||
| ## 1.5.0 | ||
|
|
||
| Released 2023-Jun-05 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this work with
LoggerSdk.EmitLog? This would be changing the behavior ofLoggerSdk.EmitLogto return an empty list instead ofnullwhen the attribute count is zero. Is that what we want?opentelemetry-dotnet/src/OpenTelemetry/Logs/LoggerSdk.cs
Line 56 in 303a357
LogRecord.Attributesdescription says that its value is set depending upon the options:IncludeAttributesorParseStateValues. Would these options be considered when usingLoggerSdk.EmitLog?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot to unpack here 🤣
I don't think it is an issue. It is all net-new so up to us to define the behavior. When calling
Logger.EmitLog(at the moment) there are always attributes. It is either user-supplied (may have 0 count or more) or it isdefault(0 count). It is a struct so there isn't a way to passnull. With this change theLogRecordwill mirror that behavior. It will always have attributes either empty (0) or some list using the pool storage.I made this change because the exporter which causes the 1.5.1 breakfix is doing...
var list = (IReadOnlyList<KeyValuePair<string, object>>)logRecord.State;It isn't checking for
nulland it isn't looking atAttributesorStateValues. If some users take a newer SDK and starts using someLogger.EmitLogthing that exporter would break again. I needed to make sure this path also had a validlogRecord.State. SinceStatewould have a value I decidedAttributes/StateValuesshould as well. It felt confusing the other way around.OpenTelemetryLoggerOptionsonly applies to theILoggerintegration. I'll open a follow-up PR to clarify the XML comments onLogRecordbecause you are right they are kind of misleading.Now you can use
LogRecordAttributeListwith theILoggerintegration! You can dologger.Log<LogRecordAttributeList>(...)which is usingLogRecordAttributeListasTStatein theILoggerAPI. This is really the only way at the moment to get truly allocation-free logging in OpenTelemetry .NET. If you setOpenTelemetryLoggerOptions.IncludeAttributes = falseAND you useLogRecordAttributeListas theTStateTHENIncludeAttributesis respected and theLogRecordends up withnullvalues forState,Attributes, andStateValues.