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

[cmd/opampsupervisor] Refactor NewSupervisor function #34597

Merged

Conversation

bsponge
Copy link
Contributor

@bsponge bsponge commented Aug 10, 2024

Description: Pass config structure to NewSupervisor instead of a file path.

Link to tracking Issue: #34379

Testing: I run tests and adjusted the existing ones

Documentation: -

Copy link
Contributor

@BinaryFissionGames BinaryFissionGames left a comment

Choose a reason for hiding this comment

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

This is working great, thanks for picking this up.

I think Evan is out for the time being, @tigrannajaryan @atoulme are either of you able review?

@crobert-1 crobert-1 added the ready to merge Code review completed; ready to merge by maintainers label Aug 12, 2024
@mx-psi mx-psi removed the ready to merge Code review completed; ready to merge by maintainers label Aug 28, 2024
}

if err := s.config.Validate(); err != nil {
if err := cfg.Validate(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

would it make sense to also move the validation into the new Load function introduced in this PR?
This would make it easier to further decouple the supervisor from other components that also use the config, such as the Commander - if we already know the config is valid before calling NewSupervisor, we can use the config to create a Commander and inject that into the Supervisor via the NewSupervisor function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added validation to Load. I wasn't sure if I should remove it from NewSupervisor but I think as long as it's possible to create config by hand (not using Load) it's better to have this.

Copy link
Contributor

@evan-bradley evan-bradley left a comment

Choose a reason for hiding this comment

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

Thanks @bsponge. I have one request, but it's not a blocker.

err = os.WriteFile(executablePath, []byte{}, 0o600)
require.NoError(t, err)

configuration := `
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you use one of the templated config files in the testdata directory for this config?

@BinaryFissionGames
Copy link
Contributor

Looks like this got a bunch of approvals but never got merged. @bsponge if you get some time, could you bring this PR up to date? Would love to get this in.

Looks like the CI failure is saying to run make genotelcontribcol, but maybe merging main would fix it, I'm not sure what changed in this PR that would make that necessary.

@evan-bradley evan-bradley requested a review from a team as a code owner October 1, 2024 18:38
@evan-bradley
Copy link
Contributor

Thanks @bsponge!

@evan-bradley evan-bradley merged commit dc63ccf into open-telemetry:main Oct 1, 2024
156 checks passed
@github-actions github-actions bot added this to the next release milestone Oct 1, 2024
jriguera pushed a commit to springernature/opentelemetry-collector-contrib that referenced this pull request Oct 4, 2024
…#34597)

**Description:** Pass config structure to `NewSupervisor` instead of a
file path.

**Link to tracking Issue:** open-telemetry#34379

**Testing:** I run tests and adjusted the existing ones

**Documentation:** -

---------

Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
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.

9 participants