-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
NDLC - Perform low resolution scope timing #2377
Conversation
3754573
to
2f76e0b
Compare
0220942
to
f8b0146
Compare
Codecov Report
@@ Coverage Diff @@
## master #2377 +/- ##
=======================================
- Coverage 82% 82% -<1%
=======================================
Files 318 319 +1
Lines 22796 22842 +46
Branches 2789 2802 +13
=======================================
+ Hits 18671 18692 +21
- Misses 3419 3426 +7
- Partials 706 724 +18 |
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.
could you please explain me in short why we need this? thx!
#if !NET3_5 | ||
builder.Append(duration.ToString(Format, formatProvider)); | ||
#else | ||
builder.Append(duration.ToString()); |
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.
formatProvider not needed here?
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 is no TimeSpan.ToString with Format or formatProvider in NET3_5
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.
Indeed, but I think the call var formatProvider = GetFormatProvider(logEvent, null);
is not needed.
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.
Fixed
{ | ||
var currentContext = GetThreadLocal(); | ||
if (currentContext == null) | ||
return DateTime.MinValue; |
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.
what about nullable datetimes?
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.
I prefer DateTime.MinValue as magic value, don't need another one.
/// Peeks the current scope, and returns its start time | ||
/// </summary> | ||
/// <returns>Scope Creation Time</returns> | ||
public static DateTime PeekCurrentScopeBeginTime() |
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.
could this be internal? (2x)
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.
Fixed
If you create a scope to mark that you have started a web-request, then you can use this to extract the timings for this scoped web-request (when logging messages that belongs to the async web-request). Maybe also use this information to perform filtering of web-requests, so logging those starting to take longer than 1 sec. I guess one could also implement this by calling NDLC.Push with a complex object, but I guess we then need to provide a PeekTop and PeekBottom to retrieve this object in a custom layout-renderer. |
a3ea8fb
to
6c81ea4
Compare
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.
thx!
6c81ea4
to
24afc90
Compare
24afc90
to
2861401
Compare
Implemented async scope timing