lightstep / lightstep-tracer-javascript

Lightstep distributed tracing library for Node.js and the browser
https://lightstep.com
MIT License
77 stars 66 forks source link

Clock skew correction should take into account wrong window.performance time on browser platform #191

Open sbaum1994 opened 4 years ago

sbaum1994 commented 4 years ago

In the nowMicros function for the browser platform implementation we try to use window.performance before falling back to Date.now() but these sometimes disagrees with window.performance.now() by significant amounts of time, causing incorrect traces if Date.now() or start times and end times are set in spans that are part of the same report.

sbaum1994 commented 4 years ago

Ideally, I think we should calculate the difference between performance.now() and Date.now() and then apply that as the clock correction offset on the spans.