-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[cmd/opampsupervisor] Refactor NewSupervisor function #34597
Conversation
There was a problem hiding this 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?
} | ||
|
||
if err := s.config.Validate(); err != nil { | ||
if err := cfg.Validate(); err != nil { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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 := ` |
There was a problem hiding this comment.
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?
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 |
Thanks @bsponge! |
…#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>
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: -