-
Notifications
You must be signed in to change notification settings - Fork 821
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
Span start and end times in the distant past on chrome #3355
Comments
Would you mind sharing the version of the OpenTelemetry SDK you are using? Thank you! |
i'm on this seems like it might be related to #3279 (comment), but to be honest im not totally sure i understand that issue. i'm not really looking for |
Can confirm that I am also experiencing this with It seems as though passing in Is there some other way to do this that I'm missing in the documentation? This date time is correct in Safari. |
It's the version of SDK which matters here, not the API version. One can provide timestamps to So either pass no timestamp to start/end or the a timestamp based on the same source to both of them to get consistent durations. You may still see time shifted spans because of the mix of time sources which may drift apart. There were issues with using performance as time source as it turned out that e.g. time was wrong after notebook went to sleep for a while. #3134 was intended to fix this by using additionally Unfortunately there are also instrumentations like #3279 discusses a solution for this problem by providing an API to read the anchored clock and allow users to take timestamps matching to that one create by SDK internally. fyi @dyladan |
@Flarna thanks for that info. Apologies, looks like I was depending on:
Which have seemingly been replaced by:
Since I last worked on this project... Is that correct to assume? It seems that switching to these libraries cause the inaccurate timestamp issue to go away for me |
ah sorry for the delay @Flarna -- super helpful context. i have the same SDK dependencies as @oliverswitzer, but haven't attempted an upgrade. it seems that #3134 was reverted, so is it safe to say this is still an open issue? is it worth keeping this open if it's so closely related to #3279? i just worry that that latter issue isnt quite as discoverable for someone who's just observing the symptoms of this bug. |
I do not recommend that version. All the
The inaccurate timestamp issue @Flarna mentioned was actually introduced in 1.7.0. Not sure what happened in
Yes it was reverted but the fix is not yet released
In this case I wish github issues had better issue linking. I added the duplicate label. I'm fine closing or leaving open. |
which timestamp bug will be fixed in 1.8.0? sounds like there are a couple:
|
1.8 will revert to <=1.6 behavior as it was causing less (but not 0) problems The long-term fix is tricky because some timestamps are provided by the instrumentation author from the performance API. When span.end is provided with a timestamp there is no way to know if it was provided by the performance timing API or from Date.now (or some other clock). |
Gotcha. Sounds like the best avenue for now is to provide explicit start and end times using (as an aside that y'all are likely aware of, I'm also noticing the same behavior for metrics, I assume the anchored clock would fix that as well) |
metrics should likely just be changed to use Date.now as there is really no benefit to the monotonic clock in that context |
ah interesting -- worth a separate issue? that sounds like a pretty easy fix, maybe i could just do that one |
@MisterSquishy maybe a separate issue yes, but i wouldn't work on it until there is consensus with the other maintainers. We may also want to introduce a global clock api which uses Date by default but can be swapped with some user clock implementation (important for nontraditional runtimes) |
ah fair enough -- ill raise the issue and see where it goes! |
Does the next 1.8.0 version solve this problem? After I update to the latest version, the time will still pass. Do I need to set the time manually? |
1.8.0 is like >=1.6.0. Only 1.7.0 was different. The change included in 1.7.0 solved the problem of drifting performance clock but it introduced problems for locations where timestamps were given manually (most browser instrumentations) therefore it was reverted (#3359). There is #3384 to improve this in upcoming release. Any input there is welcome, maybe you can even test it in your setup already now.
|
Thanks for the investigation team, I can see that this issue is linked to a chromium ticket, do we know versions of chrome where it's not an issue ? Also maybe stating the obvious (as it's linked to chrome implementation) but from local testing, Firefox and Safari don't seem to be affected by this problem. |
FWIW, Chrome 108 was released 9 hours ago with a fix - from my testing the timings aren't broken anymore. EDIT: Might have misread the bug tracker and it's currently slated for 109. But we are seeing less of this bug from 108. Might be confirmation bias, but I don't see any traces from a quick search broken with 109. |
@SimenB that sounds great edit: i see the link in description |
Also possible that as the new version had been just released there's less chances for drift to accumulate. One of the ways the drift is known to start is when the computer goes to sleep, eg most usual:
9 hours of in the wild is definitely too early to see clear patterns like above. Also the drift goes away at browser restart, which means updating the browser would clear the drift. I'd more likely assume 109 would be the release as per chromiumdash linked in crbug issue That being said idk if it's a full fix, this seems like a rollback of "Unix epoch / monotonic clock should be sync across Performance objects" (introduced in 105), but I've known about sleeping laptop bug for years (back in Plumbr's RUM which is from about 2017) - only then I came to conclusion that opening a new tab or even just hardnav (non-SPA page navigation) would fix the drift, so now I was surprised that this bug was now persisting across navigations and into new tabs - and this would explain why |
Have you made any progress on this issue recently? At present, because span is always in the past, I can only force changes in the custom exported hooks |
What happened?
Steps to Reproduce
call
trace.getTracer('service').startSpan(...)
without settingstartTime
from an instance of Chrome on version106.0.5249.119
(i'm not sure exactly how far back this open bug goes, but it's definitely in that version)Expected Result
spans emitted with start and end times reflecting the time the spans were actually started and ended
Actual Result
spans emitted with start and end times from days/weeks ago
Additional Details
this seems to be caused by a chrome bug affecting
performance.timeOrigin
; obviously the ideal thing here would be for chrome to just fix this bug. but wanted to bring this to your attention in case you weren't aware.would you recommend manually setting
startTime
when starting a span (usingDate.Now()
) for the time being? Or are we better off awaiting a fix?OpenTelemetry Setup Code
package.json
No response
Relevant log output
The text was updated successfully, but these errors were encountered: