-
Notifications
You must be signed in to change notification settings - Fork 793
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(exporters)!: collapse base classes into one #5031
Draft
pichlermarc
wants to merge
7
commits into
open-telemetry:main
Choose a base branch
from
dynatrace-oss-contrib:feat/use-export-delegate
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
feat(exporters)!: collapse base classes into one #5031
pichlermarc
wants to merge
7
commits into
open-telemetry:main
from
dynatrace-oss-contrib:feat/use-export-delegate
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pichlermarc
force-pushed
the
feat/use-export-delegate
branch
from
October 14, 2024 12:15
abff0e1
to
dbb413b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
Through recent changes I've been working on reducing code-duplication across the exporters and separating config-code, transport code and base exporter code. I'm doing this for three reasons:
In the changes I made previously, we have seen a convergence of the
OTLPExporterNodeBase
,OTLPExporterBrowserBase
, andOTLPGRPCExporterBase
classes. This PR removes all of these classes, and replaces them with an implementation of a new interface:IOTLPExportDelegate
Collapsing these into a single implementation with a single name has the benefit of fixing #4794, which was caused by differently named platform exports for Node.js and the Browser - a design-level bug that needed resolving before we can consider an OTLP Exporter GA release. I'm fixing the problem of having different public interfaces for different transports by introducing new entrypoints:
node-http
andbrowser-http
which are only imported by their respective platform-specific implementations.This export delegate contains all the behavior that is present in the OTLP exporter specification and shared across all signals. It can be created via a factory function to avoid exposing the internal API as public. Specific exporters are expected to use this delegate to eventually compose an exporter though different transports and serializers. Composition is used over inheritance as polymorphism is not of relevance when using an OTLP exporter: It is either a
PushMetricExporter
, aSpanExporter
, or aLogRecordExporter
- having anOTLPExporterBase
does not add any value to the end-user as the public interface ends up being the same. On top of that it was only used internally as it was the easy way of getting base functionality to the individual exporters. In doing so it also exposed a lot of internals as part of the public API.OTLPExporterBase
still exists but now only takes anIOTLPExportDelegate
and will eventually be removed. I've decided to keep it around to have a base for the individual exporters, which can be instantiated withnew
. In a future revision, I plan to introduce factory functions for each exporter which returns aPushMetricExporter
, aSpanExporter
, or aLogRecordExporter
instead of a specific exporter class. The factory functions will also do away with some duplicate ways of configuring transports.As a way to transition to these factory functions, this PR introduces "translation" helpers for the "old" configuration to the "new" one which is already used internally (these legacy conversions can be identified by the word
legacy
in their names).Fixes #4794
Breaking changes
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 exportsvalidateAndNormalizeHeaders
was intended for internal use and has been dropped from exportsOTLPExporterBase
all properties are now private, the constructor now takes anIOTLPExportDelegate
, the type parameter for config type has been dropped.SpanExporter
,PushMetricExporter
orLogRecordExporter
, based on their respective type.OTLPGRPCExporterNodeBase
has been removed in favor of a platform-agnostic implementation (OTLPExporterBase
from@opentelemetry/otlp-exporter-base
)TODOS
Type of change
Please delete options that are not relevant.
How Has This Been Tested?