-
Notifications
You must be signed in to change notification settings - Fork 828
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(otlp-exporter-base): internally accept a http header provider function only #5179
feat(otlp-exporter-base): internally accept a http header provider function only #5179
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5179 +/- ##
==========================================
- Coverage 94.57% 94.56% -0.01%
==========================================
Files 314 314
Lines 7956 7966 +10
Branches 1600 1601 +1
==========================================
+ Hits 7524 7533 +9
- Misses 432 433 +1
|
* feat(otlp-exporter-base)!: collapse base classes into one [#5031](https://github.com/open-telemetry/opentelemetry-js/pull/5031) @pichlermarc | ||
* `OTLPExporterNodeBase` has been removed in favor of a platform-agnostic implementation (`OTLPExporterBase`) | ||
* `OTLPExporterBrowserBase` has been removed in favor of a platform-agnostic implementation (`OTLPExporterBase`) | ||
* `ExportServiceError` was intended for internal use and has been dropped from exports | ||
* `validateAndNormalizeHeaders` was intended for internal use and has been dropped from exports | ||
* `OTLPExporterBase` all properties are now private, the constructor now takes an `IOTLPExportDelegate`, the type parameter for config type has been dropped. | ||
* This type is scheduled for removal in a future version of this package, please treat all exporters as `SpanExporter`, `PushMetricExporter` or `LogRecordExporter`, based on their respective type. | ||
* feat(otlp-grpc-exporter-base)!: collapse base classes into one [#5031](https://github.com/open-telemetry/opentelemetry-js/pull/5031) @pichlermarc | ||
* `OTLPGRPCExporterNodeBase` has been removed in favor of a platform-agnostic implementation (`OTLPExporterBase` from `@opentelemetry/otlp-exporter-base`) |
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.
Note for reviewers: this was in the wrong spot earlier, so moved it up here.
@@ -27,32 +27,34 @@ import type * as https from 'https'; | |||
|
|||
export interface OtlpHttpConfiguration extends OtlpSharedConfiguration { | |||
url: string; | |||
headers: Record<string, string>; | |||
headers: () => Record<string, string>; |
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.
Hi @pichlermarc, I have done a similar pr about that for string or function support #5118
What do you think??
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.
Hi @bozzelliandrea - I'd prefer having only one option internally (as my PR here proposes) to avoid the code becoming too complex. By only dealing with provider functions internally we can handle both static and dynamic use-cases via the same code-path.
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.
Hi @pichlermarc, do you have any idea when the team will release the version with this commit? thanks
dd5b5fb
Hi @pichlermarc I've tested this commit locally but it's not enough for the dynamically headers support, the base exporter configuration interface expect a Record<string,string> and not a function. So this feat seems only for internal purpose and not exposed externally. |
@bozzelliandrea yes, this is on purpose. We're restructuring the exporters. Legacy config is not intended to be modified since it leads to churn while we do it and delays other features - I will introduce a new interface that will expose this feature eventually. See the PR description where I already explained this. We have asked users to avoid opening PRs for exporters while we work on it. See #5149 for the reasoning behind that. |
@pichlermarc thanks for the reply, I've actually already open a pr for the dynamic header support on legacy exporter, #5221 (I hadn't seen the issue #5149 before). the change doesn't have a big impact and ensures backwards compatibility, can we consider making the feature available for legacy classes too? |
Which problem is this PR solving?
Changes internal code to always expect a header provider function, instead of a direct object. This enables us to implement #2903 later.
This does not fully implement #2903 as I want to migrate the current way of constructing an OTLP exporter to a factory function. That factory function will have a slightly different options to the existing OTLP exporters. Goal of introducing the factory function with a different interface is to:
keepAlive
, or inheaders
in this case)The changes in this PR are currently non-breaking as it's not part of the public API in any released version. So it's just internally breaking if we merge it before we release the changes from #5031.
Enables #2903
Short description of the changes
Type of change
How Has This Been Tested?