-
Notifications
You must be signed in to change notification settings - Fork 839
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
fix: use system clock for timestamps and perf clock for durations #1019
fix: use system clock for timestamps and perf clock for durations #1019
Conversation
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.
unit tests ?
Codecov Report
@@ Coverage Diff @@
## master #1019 +/- ##
==========================================
- Coverage 95.00% 94.96% -0.04%
==========================================
Files 212 212
Lines 8806 8862 +56
Branches 796 802 +6
==========================================
+ Hits 8366 8416 +50
- Misses 440 446 +6
|
) { | ||
this.name = spanName; | ||
this.spanContext = spanContext; | ||
this.parentSpanId = parentSpanId; | ||
this.kind = kind; | ||
this.links = links; | ||
this.startTime = timeInputToHrTime(startTime); | ||
|
||
if (startTime != null) { |
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 believe we should check startTime
for undefined
instead of null
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.
Mind the missing second =
- startTime != null
is the same as (startTime !== null) || (startTime !== undefined)
.
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.
Didn't see that indeed, i would prefer to have strict check so its easier to read the code though
My feeling is that this is quite a heavy change for a bug which was fixed in NodeJs 8.12.0. |
Fixes #852
Because the timestamps generated from the performance timer cannot be trusted, we can only use them to generate durations, not real timestamps. This PR introduces the following behavior:
User provides start AND end timestamps
User provides start timestamp
User provides end timestamp
User provides no timestamps