opentelemetry-js
opentelemetry-js copied to clipboard
Allow consuming app to create their own XMLHttpRequest
Which problem is this PR solving?
- Introducing createOtelJsXMLHttpRequest in sendWithXhr
- Add timeouts to some tests. They were failing on my local machine due to timeouts.
The motivation is to allow consuming to customize the type of XHR request that is created. I needed to send XHR request with Cookies. So, I needed to have the option 'withCredentials: true'. There is no good way to do it OTel JS right now and I have created an issue for it:
https://github.com/open-telemetry/opentelemetry-js/issues/4838
Of course, there is a more formal way to enable this feature but I worry that the implementation can be very complex. Being an outsider, I have limited knowledge of the full inner workings of OTel JS. Therefore, I am thinking to add this change as a stop gap measure. Just an FYI, I have a Collector extension that authenticates via Cookies, which is why I need the option 'withCredentials: true'.
I feel that the official solution should be handled by someone more experienced with this project. I don't think I am a good candidate for implementing the official solution.
Fixes # 4838 (Temporary solution)
Short description of the changes
- Introducing createOtelJsXMLHttpRequest in sendWithXhr
- Add timeouts to some tests. They were failing on my local machine due to timeouts.
Type of change
- [v] New feature (non-breaking change which adds functionality)
How Has This Been Tested?
I ran the test suite locally to ensure no regression was introduced. All tests are passing right now locally.
I did not add a test as I don't think most people will want to use this feature openly in this current form. However, if the maintainers want me to add it, please let me know where I could add a test for this feature and I am happy to do so.
Checklist:
- [v] Followed the style guidelines of this project