-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Sharecomponent logic lacks error support #30924
Comments
IMO this change, adapting to a library without error support, both introduces a potential bug --GetOrCreate() returns an object for which an error was already generated -- and yields less-readable code: fce4631 |
Pinging code owners for internal/sharedcomponent: @open-telemetry/collector-approvers. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
The goal is to move sharedcomponent from contrib and adopt it from core once it is promoted to component/sharedcomponent. See open-telemetry/opentelemetry-collector#4266 |
Removing |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been closed as inactive because it has been stale for 120 days with no activity. |
Component(s)
No response
What happened?
Description
Steps to Reproduce
Expected Result
In migrating the otel-arrow code base into this repository, #30766, we observe that the "sharedcomponent" library in this repo is different than the one in core, and deficient in terms of error handling support.
The GetOrCreate() method does not allow the function to return an error. This means the object will be cached whether the constructor succeeds or not, which means that subsequent calls to get the shared component will get an object for which the (shared) constructor returned an error, but the subsequent caller will not see the error.
Actual Result
Notice that the same library in the core repo, which the OTLP receiver uses, allows errors and does not update the cache when there is an error:
https://github.com/open-telemetry/opentelemetry-collector/blob/main/internal/sharedcomponent/sharedcomponent.go
Collector version
v0.93.0
Environment information
n/a
OpenTelemetry Collector configuration
n/a
Log output
Additional context
The core library also supports generics, which is slightly easier to use. Can we unify these two libraries?
The text was updated successfully, but these errors were encountered: