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

Refactor config sources into provider wrapper and support all service providers #2893

Merged
merged 6 commits into from
Apr 3, 2023

Conversation

rmfitzpatrick
Copy link
Contributor

@rmfitzpatrick rmfitzpatrick commented Mar 29, 2023

These changes get us closer to reconciling the original config sources and manager with the core resolver and providers that were based on them. In the process they remove unused/unnecessary fields and method requirements for the config source interfaces along with some general renaming to help with accuracy/maintainability. They also add support for existing service confmap.Provider's that would otherwise require settings declarations in our config without upstream equivalents, resolving #2536.

@rmfitzpatrick rmfitzpatrick requested review from a team as code owners March 29, 2023 23:07
@rmfitzpatrick rmfitzpatrick marked this pull request as draft March 29, 2023 23:07
Copy link
Contributor

@atoulme atoulme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read through, changes look good to me.

@rmfitzpatrick rmfitzpatrick force-pushed the configproviderreduction branch 5 times, most recently from 463d044 to 91fef18 Compare March 31, 2023 19:26
@rmfitzpatrick rmfitzpatrick marked this pull request as ready for review March 31, 2023 19:43
@@ -10,21 +10,21 @@ resource_metrics:
state: used
single-dollar: an-envvar-value-suffix
single-dollar-no-curly-braces: prefix-an-envvar-value
double-dollar: ${env:AN_ENVVAR}-suffix
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of open-telemetry/opentelemetry-collector#7055 I think this is now guaranteed to be expanded by the upstream provider. Existing compatibility persists in the non-${env:..} case.

OnShutdown()
}

type Provider interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this easier to understand for reviewers and maintainers? Looks like this interface is called Provider, its method is called Provider, and the method accepts a Provider and returns a Provider :). Do we need the interface -- it seems like the only implementer is ProviderWrapper (which is exported). And can we rename the Provider function to WrapProvider (or something) if that's what it does?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a configsource.Provider that takes a confmap.Provider and returns a confmap.Provider. I initially named the method Wrap but thought there were too many "wrap" prefixes so relied on the package name to help differentiate. The interface is helpful imo to help keep the surface area minimal while allowing changes to the implementation. Went ahead and unexported the implementation since the confmap.Provider is what's important. Also updated to use the clearer method name and added some doc comments.

Copy link
Contributor

@pmcollins pmcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this.

@rmfitzpatrick rmfitzpatrick merged commit 70b75c7 into main Apr 3, 2023
@delete-merged-branch delete-merged-branch bot deleted the configproviderreduction branch April 3, 2023 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants