Logs: Scope improvements#2026
Merged
Merged
Conversation
…items instead of object.
Codecov Report
@@ Coverage Diff @@
## main #2026 +/- ##
==========================================
- Coverage 83.90% 83.84% -0.06%
==========================================
Files 192 193 +1
Lines 6195 6247 +52
==========================================
+ Hits 5198 5238 +40
- Misses 997 1009 +12
|
CodeBlanch
commented
May 3, 2021
CodeBlanch
commented
May 3, 2021
reyang
reviewed
May 3, 2021
reyang
reviewed
May 3, 2021
Member
Author
|
Updates based on SIG discussion today:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue 1: Scopes + Batching
There is an issue in the current scope API where if you capture a
LogRecord, say for batching, the active scopes may have changed by the time the exporter runs.LogRecord.BufferLogScopeshas been introduced to copy the active scopes into a buffer which can be inspected outside of the log lifecycle. This is now used by theBatchLogRecordExportProcessor. Made opt-in because a processor likeSimpleLogRecordExportProcessordoesn't need the buffering and can use theForEachScopecall directly in the allocation-free form provided by the .NET API.LogRecord.ScopeProvideris now cleared afterProcessor.OnEndis called to prevent accidental misuse.Issue 2: Working with Scopes
objects. To be slightly more helpful we also now expose an enumerator which will return the individualKeyValuePair<string, object>s inside each scope. This makes it more aligned with the state parsing mechanism already in there. Can be done without allocation.Usage Example
Sub-item Enumeration:
API Changes
TODOs
CHANGELOG.mdupdated for non-trivial changes