Skip to content
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

Open
jmacd opened this issue Jan 31, 2024 · 6 comments
Open

Sharecomponent logic lacks error support #30924

jmacd opened this issue Jan 31, 2024 · 6 comments
Labels
bug Something isn't working internal/sharedcomponent

Comments

@jmacd
Copy link
Contributor

jmacd commented Jan 31, 2024

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

n/a

Additional context

The core library also supports generics, which is slightly easier to use. Can we unify these two libraries?

@jmacd jmacd added bug Something isn't working needs triage New item requiring triage labels Jan 31, 2024
@jmacd
Copy link
Contributor Author

jmacd commented Jan 31, 2024

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

Copy link
Contributor

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.

@atoulme
Copy link
Contributor

atoulme commented Jan 31, 2024

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

@crobert-1
Copy link
Member

Removing needs triage as these are valid concerns, but I acknowledge there's still some ambiguity of when and where the resolution will land.

@crobert-1 crobert-1 removed the needs triage New item requiring triage label Feb 6, 2024
Copy link
Contributor

github-actions bot commented Apr 8, 2024

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 @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

  • internal/sharedcomponent: @open-telemetry/collector-approvers

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Apr 8, 2024
@crobert-1 crobert-1 removed the Stale label Apr 8, 2024
Copy link
Contributor

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 @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

  • internal/sharedcomponent: @open-telemetry/collector-approvers

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Jun 10, 2024
@crobert-1 crobert-1 removed the Stale label Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internal/sharedcomponent
Projects
None yet
Development

No branches or pull requests

3 participants