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

feat(build): use the builder to set config providers #1587

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

swiatekm
Copy link

@swiatekm swiatekm commented May 20, 2024

The builder now supports setting config providers and converters via its configuration. Use that instead of our own patches. This change gets rid of a bunch of custom build code. We only keep the flags necessary to check if --remote-config and --config haven't been set at the same time.

I've also removed our custom Windows service code. The Windows service initialization in core now behaves very similarly to starting the collector normally, so doing the same thing gives the right result. One modification I had to make was deleting the opamp flag from os.Args, as the service handler calls flags.Parse, which errors on unknown flags, and there isn't a way to add our custom flag there.

Removing the custom windows code makes our custom --remote-config flag not appear in the help text when running as a Windows service, but I think that's worth it in return for being able to use the upstream service handler.

Resolves #1565

@swiatekm swiatekm force-pushed the build/collector-config-settings branch from 84421a2 to 46aed61 Compare May 21, 2024 10:38
@swiatekm swiatekm marked this pull request as ready for review May 21, 2024 11:00
@swiatekm swiatekm requested a review from a team as a code owner May 21, 2024 11:00
@rnishtala-sumo rnishtala-sumo requested a review from a team May 21, 2024 13:28
Comment on lines -161 to -162
cd cmd && go get github.com/SumoLogic/sumologic-otel-collector/pkg/configprovider/globprovider@v0.0.0-00010101000000-000000000000
cd cmd && go get github.com/SumoLogic/sumologic-otel-collector/pkg/configprovider/opampprovider@v0.0.0-00010101000000-000000000000
Copy link
Contributor

Choose a reason for hiding this comment

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

Very happy to see these lines removed 🎉

@swiatekm swiatekm marked this pull request as draft May 22, 2024 14:12
@swiatekm
Copy link
Author

Converting to draft until I figure out how the service registration should work. I think it should just work with the upstream service handler, but that's not actually the case.

@swiatekm swiatekm force-pushed the build/collector-config-settings branch from 46aed61 to 5379591 Compare May 31, 2024 09:30
@swiatekm swiatekm marked this pull request as ready for review May 31, 2024 09:52
Copy link
Contributor

@fguimond fguimond left a comment

Choose a reason for hiding this comment

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

Nice cleanup. Also validated that it works as a Windows service.

@swiatekm swiatekm force-pushed the build/collector-config-settings branch from 5379591 to d1a4fda Compare June 7, 2024 11:50
@swiatekm swiatekm force-pushed the build/collector-config-settings branch from d1a4fda to 49ce573 Compare June 7, 2024 12:26
@swiatekm swiatekm merged commit dbb4ea6 into main Jun 7, 2024
28 checks passed
@swiatekm swiatekm deleted the build/collector-config-settings branch June 7, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do we need to have collector_windows.go in this repo?
5 participants