-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Do not depend on internal packages of different modules #3846
Comments
From the SIG meeting: sounds like we would like to move forward with implementing this. |
Some of my thoughts on this:
|
@MadVikingGod I agree with all that you have written. I think that I will start with |
The otelgrpc package depedends on the core OpenTelemetry module. The OpenTelemetry module has a peculiar construction where independent modules reference internal types creating a lockstep upgrade that overflows to consuming projects. See open-telemetry/opentelemetry-go#3846 for tracking.
The otelgrpc package depedends on the core OpenTelemetry module. The OpenTelemetry module has a peculiar construction where independent modules reference internal types creating a lockstep upgrade that overflows to consuming projects. See open-telemetry/opentelemetry-go#3846 for tracking. Signed-off-by: Chris Doherty <chris.doherty4@gmail.com>
I have a working branch for a partial fix of |
Looks like just doing the retry package was too small of an approach. I have a PR staged to decouple all of |
|
Both
|
Remaining work:
|
Done |
Why
Depending on the internal packages of different modules causes being dependent module's internal API.
Therefore, a breaking change of such internal API may result in build failure for the consumer.
An example of such behavior was reported here: #3548
Below is a list of internal packages that are used across different modules:
go.opentelemetry.io/otel/exporters/otlp/internal/envconfig
go.opentelemetry.io/otel/exporters/otlp/internal/retry
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest
go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig
go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest
go.opentelemetry.io/otel/internal/baggage
go.opentelemetry.io/otel/internal/global
go.opentelemetry.io/otel/internal/internaltest
The list was created thanks to @MadVikingGod work: https://gist.github.com/MadVikingGod/65903c26582c991bd2e2704b0c2bf450
What
To solve the issue the following should be done:
gocpy
toopentelemetry-go-build-tools
CONTRIBUTING.md
what are the possibilities to share code across modules.How
For most of the packages we could copy the shared source code across modules via
go:generete
as proposed in #3841.Some packages (like
go.opentelemetry.io/otel/internal/global
) contain a shared global state. Therefore, the approach described above will not work. These packages would require special treatment on a per use-case basis.These packages may require exposing some API publicly or publishing an internal Go module that would have to be always backward compatible (if we are not confident about extending the public API). We could also consider exposing a minimal API (required to access the shared state) and use
gocpy
to generate not-exported functions. For instance, we could exportotel.Logger()
and generatelogError
,logInfo
,logDebug
functions.Take notice that the
gocpy
approach will not fix the issue for older modules as they will still depend on the internal API.We can keep the existing internal modules to make lives easier for the users (and mark all internal API as deprecated),
I am unsure if the maintenance cost of keeping the deprecated internal packages is worth the value (possible inconvenience that we will introduce). EDIT: @MadVikingGod suggests to both leave the current APIs where they are and depreciate them when the copied versions exist.
What is the priority of this issue? Do the maintainers see to need to have the issue solved? While I can work on addressing it, I assume it will still consume a lot of effort to review it.The text was updated successfully, but these errors were encountered: