-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Hoist activity fields to the logging scope #11211
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
Conversation
- Expose SpanId, TraceId and ParentId to logging scope properties - Added tests to verify the Hierarchical ID format
Co-Authored-By: Liudmila Molkova <[email protected]>
Do you need to capture the fields to |
I was going to but storing the async local felt strange. I'll need to experiment with that. |
That's just a tangental bit of Activity? Hosting creates the Scope, Activity and starts it; as well as Disposing the Scope and ending the Activity, and the Activity doesn't get reused, so should be ok? |
// Arrange | ||
|
||
// Generate an id we can use for the request id header (in the correct format) | ||
var activity = new Activity("IncomingRequest"); |
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.
BTW @lmolkova this why I'd like this feature https://github.com/dotnet/corefx/issues/36999. It's makes unit testing possible.
Yes, you're right, it would just be storing the activity object on 2 async locals (Activity.Current and the logging scope). It does mean it would have similar issues to holding onto the HttpContext but maybe it won't be as big a problem since not much is stored on the activity currently. |
🆙 📅 |
This reverts commit f7a2d3c.
* Revert "Hoist activity fields to the logging scope (#11211)" This reverts commit f7a2d3c. * Remove tests with Activity * Remove ActivityId from HostingLogScope * Enable propogation in CreateDefaultBuilder * Clean up * s/logging/loggingBuilder * Enable Activity propogation for generichost * Replace with runtime/pull/37892
Fixes #9491
PS: I need to spend some time looking at allocations before I merge this.
cc @benaadams
cc @lmolkova @SergeyKanzhelev for review