-
Notifications
You must be signed in to change notification settings - Fork 795
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: collector exporter custom headers and metadata #1204
feat: collector exporter custom headers and metadata #1204
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1204 +/- ##
=======================================
Coverage 92.32% 92.32%
=======================================
Files 122 122
Lines 3533 3533
Branches 714 714
=======================================
Hits 3262 3262
Misses 271 271 |
super(config); | ||
this._headers = config.headers || this.DEFAULT_HEADERS; | ||
this._useXHR = | ||
!!config.headers || typeof navigator.sendBeacon !== 'function'; |
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.
should this be !!this._headers || ...
, or do we explicitly not care about sending only DEFAULT_HEADERS
here?
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 there are custom headers to be sent, then spans must be sent using an XMLHTTPRequest, the beacon doesn't support arbitrary headers. If there are not custom headers, and the browser has beacon support, spans will be sent using it.
There is one default header, it's collectorTypes.OT_REQUEST_HEADER
which is a signal to the XMLHTTPRequest plugin not to trace the request. This would come into play if there are not any custom headers, and the browser does not have beacon support. A better long term solution for this would be #1040. It would clean this up and we could remove default headers altogether.
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.
makes sense thanks!
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, thx for changes
Which problem is this PR solving?
Short description of the changes