Reduce allocations when Activity is enabled#11020
Merged
Conversation
- Remove string allocations caused by DiagnosticSource.Stop/StartActivity - Pass the HttpContext directly as the object for StartActivity and StopActivity to avoid the anonymous object allocation. - Though it's a bit ugly, added an HttpContext property to DefaultHttpContext to avoid breaking back-compat (which had to do reflection to get the HttpContext property anyways)
Tratcher
reviewed
Jun 9, 2019
- Mark HttpContext field as editable browsable never - Ran code check
watfordgnf
reviewed
Jun 10, 2019
Co-Authored-By: Christopher Watford <christopher.watford@ge.com>
Tratcher
approved these changes
Jun 10, 2019
Member
Author
|
cc @lmolkova @SergeyKanzhelev as an FYI, this should be non breaking though. |
lmolkova
reviewed
Jun 14, 2019
| { | ||
| hasDiagnosticListener = true; | ||
| _diagnosticListener.StartActivity(activity, new { HttpContext = httpContext }); | ||
| StartActivity(activity, httpContext); |
There was a problem hiding this comment.
I like this and we may be able to update listener in time for 3.0 to support it. But it is breaking (i.e. there is no HttpContext property on HttpContext type), everyone who attempts to get it will fail.
There was a problem hiding this comment.
ooops, you've added property on HttpConetxt 😂
Member
Author
There was a problem hiding this comment.
HttpContext.HttpContext 😄
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.
Contributes to #9594
Before:

After:
