-
Notifications
You must be signed in to change notification settings - Fork 765
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
Logs: Scope improvements #2026
Logs: Scope improvements #2026
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
|
…entelemetry-dotnet into log-scope-batching
Updates based on SIG discussion today:
|
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.
LGTM.
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.
Thanks!
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.BufferLogScopes
has 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 likeSimpleLogRecordExportProcessor
doesn't need the buffering and can use theForEachScope
call directly in the allocation-free form provided by the .NET API.LogRecord.ScopeProvider
is now cleared afterProcessor.OnEnd
is called to prevent accidental misuse.Issue 2: Working with Scopes
object
s. 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.md
updated for non-trivial changes