-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Description
Activity source started events on .net framework don't have accurate duration. This appears to be due to the use of DateTime.UtcNow:
runtime/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
Line 1020 in 8861c41
| activity.StartTimeUtc = startTime == default ? DateTime.UtcNow : startTime.UtcDateTime; |
In other code paths GetUtcNow() is used to get an accurate timestamp.
runtime/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
Line 576 in 8861c41
| StartTimeUtc = GetUtcNow(); |
This can be observed by durations being 00:00:00.0000001 on .net framework.
Configuration
.net framework 4.8
Windows 10 2004.
x64
Regression?
Not a regression, as activity source is new, but diagnostic source had accurate durations.
Other information
I suspect the only workaround is to provide an accurate timestamp to the calls to StartActivity.