feat: add excluded codes option from hystrix error tracking#13
Conversation
📝 WalkthroughWalkthroughAdds Hystrix exclusion by gRPC status code: new client option to register excluded codes and updated interceptor logic that detects gRPC status errors and skips Hystrix fallback when the error's code matches an excluded code. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Hystrix
participant Interceptor
participant Invoker
participant gRPC_Status
Client->>Hystrix: invoke command
Hystrix->>Interceptor: call invoker wrapper
Interceptor->>Invoker: invoke RPC
Invoker-->>Interceptor: returns error
Interceptor->>gRPC_Status: parse error -> status.Code
alt code in excludedCodes
Interceptor-->>Hystrix: return nil (skip Hystrix fallback)
else not excluded
Interceptor-->>Hystrix: return original error (Hystrix handles)
end
Hystrix-->>Client: final response/error
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @ankurs. * #13 (comment) The following files were modified: * `interceptors.go` * `options.go`
There was a problem hiding this comment.
Pull request overview
This PR adds functionality to exclude specific gRPC status codes from triggering Hystrix circuit breaker fallback, providing more granular control over error handling behavior.
Changes:
- Added a new
WithHystrixExcludedCodesoption function to allow specifying gRPC status codes that should be excluded from Hystrix error tracking - Extended the Hystrix client interceptor to check for excluded gRPC status codes in addition to the existing excluded errors functionality
- Updated auto-generated README documentation to reflect line number changes in the source code
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| options.go | Added excludedCodes field to clientOptions struct and new WithHystrixExcludedCodes function to configure excluded gRPC status codes |
| interceptors.go | Enhanced HystrixClientInterceptor to check if error status code matches any excluded codes and skip Hystrix circuit breaker tracking for those codes |
| README.md | Updated auto-generated documentation links to reflect new line numbers after code additions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Docstrings generation was requested by @ankurs. * #13 (comment) The following files were modified: * `interceptors.go` * `options.go` Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Ankur Shrivastava <ankur@ankurs.com>
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.