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
Allow setting numeric config variables in config update endpoint #9548
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.
The change looks good!
I just feel like this could be somewhat of a rabbit hole without a standardized way of handling things (is the config responsible of the parsing or the providers?). However, the config update is a bit brittle, but somewhat safe if we - as the ones who know its limitations - are using it. 😄
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 maybe add a quick test here? tests.integration.test_config_endpoint.test_config_endpoint
I think the change is rather small and innocuous, but it'd be nice to validate the behaviour.
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 a lot for adding the test, LGTM! 👍
del config.FOO | ||
config_listener.CONFIG_LISTENERS.remove(custom_listener) |
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.
good catch!
Motivation
One of the Chaos Engineering features we want to enable in the Web app with @webdev51 is setting the
KINESIS_ERROR_PROBABILITY
/DYNAMODB_ERROR_PROBABILITY
config variables, to simulate rate limiting for Kinesis/DynamoDB.This can be enabled by asking the user to enable
ENABLE_CONFIG_UPDATES=1
on LS startup (with the caveats / security implications that come with it, and which we have also documented in our docs), and then using the config update endpoint.However, currently updating the value to
ENABLE_CONFIG_UPDATES=1
is not fully working, as the service providers expect those values to be numeric, whereas the config update listener sets them as string. It seems reasonable to check if config values are numeric, and then convert them to float (the other approach would be to fix the logic in the provider, to be able to handle bothfloat
andstr
values).Changes
is_number(..)
check to config update, to automatically convert numeric strings to numbers