Skip to content
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

Why is it that sometimes the time of each documentLoad‘s span is not the time of the Trigger Event(eg: Date.now()), It is based on the time calculated by performance.timeOrigin #3339

Closed
yuanman0109 opened this issue Oct 16, 2022 · 7 comments
Labels
signal:traces Issues and PRs related to general traces signal

Comments

@yuanman0109
Copy link

yuanman0109 commented Oct 16, 2022

in browser, I observed the exported data and found that the request params startTimeUnixNano or endTimeUnixNano of the documentload event was converted to seconds later and Date.Now() is not equal. I don't know whether it is a normal phenomenon. I think that the correct time should be the time of the event;
image
Take a look at this screenshot, occasionally, endTimeUnixNano is smaller than startTimeUnixNano

@yuanman0109 yuanman0109 changed the title Why is it that sometimes the time of each documentLoad‘s span is not the time of the event, but the time of the last restart of the computer Why is it that sometimes the time of each documentLoad‘s span is not the time of the Trigger Event(eg: Date.now()), It is based on the time calculated by performance.timeOrigin Oct 17, 2022
@legendecas
Copy link
Member

Would you mind sharing the setup you are using to produce the trace results? Specifically, what instrumentation you have enabled to generate the trace?

@yuanman0109
Copy link
Author

yuanman0109 commented Oct 19, 2022

Would you mind sharing the setup you are using to produce the trace results? Specifically, what instrumentation you have enabled to generate the trace?

image
Thank you for your reply. I checked the source code and found that the startTimeUnixNano or endTimeUnixNano times of this event are based on performance.timeOrigin(), (eg: xhr plugin end event time is const endTime = (0, core_1.hrTime)(); ), If our browser tag window is not closed, the time will be the same in a few days. but our server needs to know the real-time time of the event. They prefer Date.now(), because they need to query the data of a specific day according to this time.
I want to know how I can change the span's startTimeUnixNano and endTimeUnixNano properties and pass them to the server according to the event occurrence time. And why is the startTimeUnixNano smaller than the endTimeUnixNano ? Or whether there are other ways to meet the server's need for data splitting based on the event occurrence time

@legendecas
Copy link
Member

Would you mind sharing the version of the SDK you are using? 5818129 should have fixed this kind of issue. Would you mind verifying with the latest version of SDK?

@yuanman0109
Copy link
Author

yuanman0109 commented Oct 21, 2022

Would you mind sharing the version of the SDK you are using? 5818129 should have fixed this kind of issue. Would you mind verifying with the latest version of SDK?

tks, The following is the version information of the dependent package. I think I have the same problem as others 3320, 3279 the browser time problem fixed? At present, xhr, fetch, and documentLoad plugin have the same time problem because they all rely on performance.timeOrigin, From the exported data, it can be seen that the endTimeUnixNano time is wrong, which is always less than the startTimeUnixNano time. My browser has not been closed, which will lead to performance in the past.
image

@yuanman0109
Copy link
Author

What's the progress on this issue

@legendecas
Copy link
Member

Related: #3279. And #3359 is going to fix it.

/cc @dyladan

@legendecas legendecas added the signal:traces Issues and PRs related to general traces signal label Oct 26, 2022
@dyladan
Copy link
Member

dyladan commented Nov 2, 2022

PR is merged and waiting on a release. Closing this since there are already multiple issues open which deal with it

@dyladan dyladan closed this as completed Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
signal:traces Issues and PRs related to general traces signal
Projects
None yet
Development

No branches or pull requests

3 participants