-
Notifications
You must be signed in to change notification settings - Fork 108
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
A way to ignore certain type of errors #262
Comments
All |
Yeah, I could do this. |
I agree that a 4xx error does not necessarily mean that the service is unhealthy and should be configurable to not count as a failure, but it still makes sense to pass the error through as expected. |
I really think this is in the domain of the client application and not something that |
@lance, while agree that any logic should happen outside of the module, right now it is all or nothing. There is no way to conditionally decide if a response should trip the circuit breaker and I would argue that there are some cases where a response should bypass the breaker. In those cases it is up to the module to provide the functionality to do so. |
I totally agree that Let's imagine the following example (pretty close to that I encountered with):
Now I've got a task to add a circuit breaker to the request. I change the code:
In this case This behaviour could be mitigated by configuration - To my opinion, this could be managed in such a way:
With the changes, described above, the code would be look like:
I already made similar changes and need to polish the code and naming. After that, I would be ready to introduce PR with the feature, if you would accept it.
I not a Java-guy, but AFAIK Hystrix allows for user's code to bypass metrics by wrapping an exception by wrapping the error with https://netflix.github.io/Hystrix/javadoc/com/netflix/hystrix/exception/HystrixBadRequestException.html |
OK - I can see the value of this. I'll reopen and give it some thought. |
@RidgeA after more thought and reading your suggestion a bit more carefully, yes I would definitely accept this change. I would like to see tests and docs along with it as well, please. If you want to submit what you have now as as a work in progress PR, that's fine. As for naming, I don't like |
I'm attempting to use Not sure I like The signature that @RidgeA presented looks good: const httpClient = () => {
const breaker = opossum(axiosClient, {
// Return true if the error
incrementError: error => error.statusCode <= 500 && error.statusCode <= 599 &
});
return (...params) => breaker.fire(...params);
} |
@jahredhope thanks for your offer of a PR. I had this on my todo list for tonight, and it was a pretty simple change. Please have a look at it. #281 |
Hello!
I use the
request
module with the opossum to communicate between microservices.In case if other microservice returns HTTP 4xx error, this is treated as an error and could lead to breaker opening. But in major cases, 4xx HTTP status is a valid and expected result.
So, I need somehow to tell opossum to ignore certain types of error and return them as is and don't treat them as an error.
Is it feasible?
The text was updated successfully, but these errors were encountered: