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

Fix order of events #32

Open
rudpot opened this issue Apr 29, 2022 · 2 comments
Open

Fix order of events #32

rudpot opened this issue Apr 29, 2022 · 2 comments

Comments

@rudpot
Copy link

rudpot commented Apr 29, 2022

Executing the lambda handler in all cases and only over-writing the error code if a valid parameter result is received means that the function code will be invoked and will falsely report an error instead of not being invoked and reporting a fake error.

if _fault_type == "status_code":
result = func(*args, **kwargs)
if isinstance(_chaos_conf.get("error_code"), int):
_error_code = _chaos_conf.get("error_code")

The simple solution would be to fix the order of operations. The structurally better solution would be to rebuild the whole library with a hooks pattern where the customer could define a list of faults/frequencies to inject before and after function execution.

@adhorn
Copy link
Owner

adhorn commented Jun 9, 2022

@rudpot why would invoking and reporting a fake error be better than invoking and overriding the response?

@rudpot
Copy link
Author

rudpot commented Jun 9, 2022

As a consumer I would like the freedom to choose whether a fault injection should occur before or after the business logic is executed. Or, more to the point, whether the business logic is invoked at all. Both have value to test different aspects of application resilience.

However, as AWS employee, in a situation where that choice does not exist, I would err on the side of "safe" failures. Executing the business logic but reporting the execution as failed will create an inconsistent state in the application between upstream and downstream components. This creates a much higher bar for application resilience than not executing the business logic and just reporting a failure. The latter might create an inconsistent state but it would be limited to the upstream components and would be transparent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants