-
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
chore: adding interceptor for getting headers before each request #2050
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2050 +/- ##
==========================================
+ Coverage 92.73% 92.75% +0.01%
==========================================
Files 137 138 +1
Lines 4915 4927 +12
Branches 1015 1017 +2
==========================================
+ Hits 4558 4570 +12
Misses 357 357
|
@open-telemetry/javascript-approvers ^^, thx |
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 to be a lot of function indirection here for quite a simple feature. Why do we have _beforeSend
and _getHeaders
and prepareGetHeaders
and getHeadersBeforeSend
?
Seems like the easiest solution would be more like:
class ZipkinExporter {
// ...
_getExportHeaders?: () => Map<string, string>;
constructor(config: zipkinTypes.ExporterConfig) {
// ...
if (typeof config._getExportHeaders === 'function') {
this._getExportHeaders = config._getExportHeaders
}
}
}
and in send you just do headers = this.__getExportHeaders?.() ?? {};
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.
Approving. Feel free to change the name or keep it
Which problem is this PR solving?
Short description of the changes