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

LOOPP plugin config validation service #12430

Merged

Conversation

george-dorin
Copy link
Contributor

@george-dorin george-dorin commented Mar 14, 2024

  • Instantiate and call validation when a generic plugin config is validated

Copy link
Contributor

I see that you haven't updated any README files. Would it make sense to do so?

…-validation

# Conflicts:
#	core/scripts/go.mod
#	core/scripts/go.sum
#	go.mod
#	go.sum
#	integration-tests/go.mod
#	integration-tests/go.sum
#	integration-tests/load/go.mod
#	integration-tests/load/go.sum
Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset.

@george-dorin george-dorin marked this pull request as ready for review March 20, 2024 14:07
@george-dorin george-dorin requested review from a team as code owners March 20, 2024 14:07
@george-dorin george-dorin requested review from a team as code owners March 20, 2024 14:07
}

loopID := fmt.Sprintf("%s-%s-%s", p.PluginName, spec.ContractID, spec.GetID())
cmdFn, grpcOpts, err := rc.RegisterLOOP(plugins.CmdConfig{
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems a bit odd that we're registering the LOOPP only to immediately unregister it. Do we even need to register it, and if so, why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the plugin is started it requires a prometheusPort, in order to get a valid port we must register the LOOPP

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, this seems inverted.

what is the goal of this code?

another red flag is starting and closing the plugin. why is that happening?

if we register and unregister for the purpose of getting a port and validating a port, then we are still open to failure later when re-register it because there is dynamic code to allocate the port. moreover, the port will be different, so what use is the first registration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@krehermann To validate the config we must start the binary so we can call the validateConfig() that is inside the LOOPP, this has to happen inside the LOOPP because we do not know what configuration it expects. When the LOOPP is started, as part of the registration, a Prometheus port is expected, that is why we are registering the LOOPP.

Copy link
Contributor

Choose a reason for hiding this comment

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

@krehermann We thought about this quite a bit, and @george-dorin is correct -- I agree that it's counter-intuitive to register and deregister immediately but it's not clear what alternative there is given that the point of registering is to "lock" host resources such as the prometheus port.

Copy link
Contributor

Choose a reason for hiding this comment

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

The point of this code is just to call out the LOOPP to validate the config; we aren't trying to do any validation with respect to allocation of system resources and we aren't guaranteeing that a successful validation implies that we will definitely start a LOOPP either.

…-validation

# Conflicts:
#	core/scripts/go.mod
#	core/scripts/go.sum
#	go.mod
#	go.sum
#	integration-tests/go.mod
#	integration-tests/go.sum
#	integration-tests/load/go.mod
#	integration-tests/load/go.sum
…-validation

# Conflicts:
#	core/scripts/go.mod
#	core/scripts/go.sum
#	go.mod
#	go.sum
#	integration-tests/go.mod
#	integration-tests/go.sum
#	integration-tests/load/go.mod
#	integration-tests/load/go.sum
…-validation

# Conflicts:
#	core/scripts/go.mod
#	core/scripts/go.sum
#	go.mod
#	go.sum
#	integration-tests/go.mod
#	integration-tests/go.sum
#	integration-tests/load/go.mod
#	integration-tests/load/go.sum
…-validation

# Conflicts:
#	integration-tests/go.mod
#	integration-tests/load/go.mod
@george-dorin george-dorin added this pull request to the merge queue Apr 4, 2024