-
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
fix(instrumentation-fetch): perf observer bugs #1868
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1868 +/- ##
==========================================
- Coverage 92.65% 92.45% -0.20%
==========================================
Files 174 174
Lines 6030 6034 +4
Branches 1278 1280 +2
==========================================
- Hits 5587 5579 -8
- Misses 443 455 +12
|
const entries = list.getEntries() as PerformanceResourceTiming[]; | ||
entries.forEach(entry => { | ||
if (entry.initiatorType === 'fetch' && entry.name === spanUrl) { | ||
const perfObsEntries = list.getEntries() as PerformanceResourceTiming[]; |
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.
Feels like we should have a separate PR to turn on no-shadow
for eslint. A quick trial of it shows 101 instances in this repo.
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.
If you think that would avoid more bugs, could you open an issue so someone can handle it at some point ? (i could have opened it but i don't really understand whats shadowing exactly)
this._addFinalSpanAttributes(span, response); | ||
|
||
setTimeout(() => { | ||
spanData.observer?.disconnect(); |
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 was really subtle; thanks for catching 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.
lgtm, nice findings
Which problem is this PR solving?
Short description of the changes
observer.disconnect
to the setTimeout so it is not disconnected before the 300ms timeout. XHR instrumentation seems to work fine.entries
variable inside perf observer callback, currently empty entry list is always returned.