-
Notifications
You must be signed in to change notification settings - Fork 544
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(express): use the same clock for span start and end #1210
fix(express): use the same clock for span start and end #1210
Conversation
Hey @dyladan - first off thank you so much for your work on the anchored clock to mitigate the time drift! |
There definitely could be a similar issue but I'm surprised to see it both in XHR and Fetch. Is that happening on all spans or just some? |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1210 +/- ##
==========================================
+ Coverage 96.08% 96.64% +0.56%
==========================================
Files 14 20 +6
Lines 893 1132 +239
Branches 191 245 +54
==========================================
+ Hits 858 1094 +236
- Misses 35 38 +3
|
Good question @dyladan , looks like in our case it happened on a significant portion of the spans but not all of them: |
All of the bad spans are coming from the same instrumentations? Do you have any other instrumentations? Are they reporting good or bad spans? |
Majority of the "negative" spans were coming from XHR and Fetch instrumentations. Notable, document load wasn't affected at all as it probably just uses the timings provided by the browser resource timing. |
Relevant code for the XHR instrumentation: I think both Fetch and XHR have to store the timestamp and then schedule a timeout to wait for the network events to be ready. There's a comment explaining that:
|
Fixes #1193
Fixes #1209
Express instrumentation does not pass a time to span start but does pass a time to span.end, which results in undefined behavior. Previous to open-telemetry/opentelemetry-js#3134 this was not a problem as the span always used the same hrTimer that we expose in core. Now that we anchor clocks, it is possible for these clocks to be out of sync.