-
Notifications
You must be signed in to change notification settings - Fork 852
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
refactor!: convert all SDK timestamps from HrTime to bigint #5522
Open
dyladan
wants to merge
29
commits into
open-telemetry:main
Choose a base branch
from
dynatrace-oss-contrib:hrtime-to-bigint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,116
−797
Open
Changes from 12 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
2c6b922
refactor!: convert all SDK timestamps from HrTime to bigint
dyladan 7ef4dbd
Changelog
dyladan c4cb812
Lint
dyladan addb504
Fix conversion
dyladan 19e1224
Fix zipkin tests
dyladan 641f56f
Lint
dyladan 989479a
Update packages/opentelemetry-core/src/common/time.ts
dyladan fb2c16c
Merge branch 'main' into hrtime-to-bigint
dyladan 460d81d
Add logs to test
dyladan b5a32cd
Log start time too
dyladan d2c1506
Remove deep paths
dyladan 9ed865f
log inconsistent times
dyladan 6af9780
Gratuitous logging
dyladan 7635a74
Fix time conversion
dyladan c2ca60e
Remove logging stuff
dyladan 1d040bf
Use bigint in test case
dyladan ed25018
Fix browser tests
dyladan 042f294
Add backwards compatible getters to metrics timestamps
dyladan 0053b42
Add backwards compatible getters to logs timestamps
dyladan 335367f
Revert messed up browser tests
dyladan ca0a17e
Lint
dyladan 618dd6b
Merge branch 'main' into hrtime-to-bigint
dyladan eb5dadb
Remove param comment
dyladan 8934944
Merge branch 'main' into hrtime-to-bigint
dyladan 283c521
Undo API change
dyladan 319ec97
Naming nit
dyladan 7090018
Fix compile
dyladan a9b53e4
Remove obsolete test
dyladan 3f01070
Lint
dyladan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,18 +142,18 @@ | |
return BigInt(millis) * 1_000_000n; | ||
} else { | ||
const out = | ||
BigInt(Math.round(millis)) * 1000000n + | ||
BigInt(Math.trunc(millis)) * 1000000n + | ||
BigInt(Math.round((millis % 1) * 1000000)); | ||
return out; | ||
} | ||
} | ||
|
||
export function nanosecondsToMilliseconds(nanos: bigint): number { | ||
return Number(nanos / 1_000_000n); | ||
} | ||
|
||
export function nanosecondsToMicroseconds(nanos: bigint): number { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to above, this loses the fractional microseconds. |
||
return Number(nanos / 1_000n); | ||
} | ||
|
||
export function nanosToHrTime(nanos: bigint): api.HrTime { | ||
|
This file contains 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
Oops, something went wrong.
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.
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.
This impl (and less so the impl for
nanosecondsToMicroseconds
below) loses precision: the fractional-milliseconds get dropped.I think this would work: