-
Notifications
You must be signed in to change notification settings - Fork 824
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(plugin-xml-http-request): support sync requests #1133
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1133 +/- ##
==========================================
+ Coverage 92.28% 92.30% +0.02%
==========================================
Files 116 116
Lines 3396 3393 -3
Branches 686 685 -1
==========================================
- Hits 3134 3132 -2
+ Misses 262 261 -1
|
Sorry for the failing action. It seems there is a permissions issue, so I filed a PR to strip it out #1134 |
No worries! I'm already a member of otel and have contributed to other projects here, so it wasn't super important for me anyway. Your contribution guidelines are clear and easy to follow and I appreciate the PR template! |
packages/opentelemetry-plugin-xml-http-request/test/xhr.test.ts
Outdated
Show resolved
Hide resolved
@obecny as you wrote plugin-xml-http-request, would love to get your eyes on this. |
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, one comment, thx
packages/opentelemetry-plugin-xml-http-request/test/xhr.test.ts
Outdated
Show resolved
Hide resolved
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.
It seems hard to believe that such a minor change would add this functionality when it was explicitly unsupported. There must have been a reason?
reading from spec:
And in spec it is also mentioned that sync will return true or false and events are fired for async - nothing mentioned about sync. But I checked the chrome with sync and yes it seems like the event is also fired and it works fine. |
Which problem is this PR solving?
XHR with async=false are currently unsupported with the instrumentation in plugin-xml-http-request, producing a warning message.
Short description of the changes
The spec promises that our onLoad/onError/etc. callbacks will be called as part of the synchronous send(). Therefore, the existing logic of hooking open+send and using these callbacks to determine span end works fine for the synchronous case as well. I've manually verified this in an Angular app using synchronous-mode xhr (on several browsers) and added a simple unit test showing this as well.