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

Ability to ignore exception types when counting breaker errors #37

Merged
merged 2 commits into from
May 23, 2015

Conversation

robhruska
Copy link
Member

Particularly with [Command], there can be times where an exception (e.g. an input validation error) gets thrown from ExecuteAsync(), but we shouldn't increment the breaker error count because there's actually nothing wrong with the service.

Add the ability to register a list of ignored exception types, which will be counted as success instead of failure.

A future consideration would be to add a third metric (alongside success and failure) to track these independently - I don't see the need for that just yet.

{
CircuitBreaker.Metrics.MarkCommandFailure();
if (CommandContext.IsExceptionIgnored(e.GetType()))

Choose a reason for hiding this comment

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

Could e be wrapping another exception let us the implements is awaiting on an async call for example, and that throws an exception, for now do we just get e's type? I don't see an immediate need but wanted to plant a seed, if it is worth planting

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, possibly. I'm not sure how expensive it'll be to add an IsAssignableFrom() or equivalent call into here, though. I'll look into it - good call.

Copy link
Member Author

Choose a reason for hiding this comment

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

Having thought about this a bit more, I think I like the non-inheritance checking way. It's easy to opt into more types if you want parents/children to also be ignored, but if we use IsAssignableFrom() and assume the whole hierarchy, it doesn't leave the option to opt out of any children that you don't want ignored.

robhruska added a commit that referenced this pull request May 23, 2015
Ability to ignore exception types when counting breaker errors
@robhruska robhruska merged commit 32de88c into master May 23, 2015
@robhruska robhruska deleted the ExceptionWhitelist branch May 23, 2015 01:47
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

Successfully merging this pull request may close these issues.

None yet

2 participants