-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(apm): Update Span timing from absolute ref #2479
Conversation
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceTiming/navigationStart
In Chrome Linux 80.0.3987.122 (Official Build) (64-bit),
Node.js also has Going to update to use |
89db11c
to
830362c
Compare
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.
👌 (after linter fixes)
830362c
to
3094034
Compare
Use performance.timeOrigin as the absolute reference to update Span start and end timestamps.
3094034
to
3a5d9a1
Compare
navigationOffset = transactionSpan.data.offset; | ||
} | ||
|
||
const timeOrigin = Tracing._msToSec(performance.timeOrigin); |
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.
@rhcarvalho I came across this polyfill to replace an older Chrome API: https://developers.google.com/web/updates/2017/12/chrome-loadtimes-deprecated#startloadtime
wondering if we could make use of it?
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.
Yes.
Let's open the can of worms.
Need to make sure whether the times in entries are relative to timeOrigin
or navigationStart
, if the two ever differ -- @HazAT and I have only seen performance.getEntriesByType('navigation')[0].startTime === 0
.
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 potential update could be something that can be in a new PR; not in this PR 👍
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.
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/startTime
The
startTime
property returns the first recorded timestamp of the performance entry.The value returned by this property depends on the performance entry's type:
...
"navigation" - returns the timestamp with a value of "0".
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.
Seems that the timeOrigin
and navigationStart
should be the same in practice.
In that case, startloadtime is unnecessarily verbose, giving us nothing more than what we have now? @dashed wdyt?
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.
@rhcarvalho that makes sense. I didn't realize navigation
is essentially 0
. Thank you for investigating this further 👍
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.
Looks good to me 👍
Use
performance.timeOrigin
as the absolute reference to update Span start and end timestamps.With this in, we could remove the
data.offset
value from Spans, and instead/additionally use something else to mark modifications to spans that might make it easier to search/filter.