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

Return an error on config.Map.Set #4467

Closed
mx-psi opened this issue Nov 22, 2021 · 15 comments · Fixed by #5485
Closed

Return an error on config.Map.Set #4467

mx-psi opened this issue Nov 22, 2021 · 15 comments · Fixed by #5485
Assignees
Labels
good first issue Good for newcomers release:required-for-ga Must be resolved before GA release

Comments

@mx-psi
Copy link
Member

mx-psi commented Nov 22, 2021

seems there's at least a couple of calls that could trigger an error in this func with Load just above this line, I would be in favour of returning an error from Set

Originally posted by @codeboten in #4462 (comment)

@jpkrohling jpkrohling added the good first issue Good for newcomers label Nov 22, 2021
@jpkrohling
Copy link
Member

Looks like a good first issue?

@mx-psi
Copy link
Member Author

mx-psi commented Nov 22, 2021

@jpkrohling yes, I think this should also be required for GA since it's a breaking change

@jpkrohling jpkrohling added the release:required-for-ga Must be resolved before GA release label Nov 22, 2021
@shree007
Copy link
Contributor

@jpkrohling I will take a look into it.

@bogdandrutu
Copy link
Member

@mx-psi I understand the current implementation of "Set" may do this, but I am not sure conceptually when a "Set" func would return an error if you were implementing this?

@mx-psi
Copy link
Member Author

mx-psi commented Jan 11, 2022

@bogdandrutu I gave some thought to this and I don't have a strong view on it either way. One conceptual argument in favor of returning an error on Set is that we return an error on Merge: it feels inconsistent to return an error on one method but not on the other (internally they are the same koanf error after all).

@bogdandrutu
Copy link
Member

The error on Merge is if for one key we change the type, maybe we should document the same. Then it may make sense :)

@mx-psi
Copy link
Member Author

mx-psi commented Jan 12, 2022

That would make sense to me, yes. @shree007, what do you think?

@shree007
Copy link
Contributor

shree007 commented Jan 12, 2022 via email

@mx-psi
Copy link
Member Author

mx-psi commented Jan 13, 2022

Sounds reasonable to me

@bogdandrutu
Copy link
Member

@mx-psi @shree007 I think nobody uses "Set" anymore, should we better remove the API?

@shree007
Copy link
Contributor

shree007 commented Mar 22, 2022

@bogdandrutu If nobody is using then I can proceed for code cleanup, I mean remove the API
cc: @mx-psi @jpkrohling

@bogdandrutu
Copy link
Member

@shree007 let's craft a PR.

@shree007
Copy link
Contributor

shree007 commented Mar 23, 2022 via email

@mx-psi
Copy link
Member Author

mx-psi commented Mar 23, 2022

We make use of Set on the Datadog Agent OTLP endpoint, to transform a Viper map into a config.Map. I think it's safe to remove and we could take a different approach and avoid using Set.

@shree007
Copy link
Contributor

@bogdandrutu Before removing I am checking and found that there are two places where its being used
https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configmapprovider/expand.go#L30
https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/internal/configsource/manager.go#L212
Should I still proceed to craft the PR for removing ?
Please let me know thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers release:required-for-ga Must be resolved before GA release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants