Skip to content

feat: add excluded codes option from hystrix error tracking#13

Merged
ankurs merged 2 commits intogo-coldbrew:mainfrom
dandynaufaldi:add-exclded-rpc-code-from-hystrix
Jan 27, 2026
Merged

feat: add excluded codes option from hystrix error tracking#13
ankurs merged 2 commits intogo-coldbrew:mainfrom
dandynaufaldi:add-exclded-rpc-code-from-hystrix

Conversation

@dandynaufaldi
Copy link
Contributor

@dandynaufaldi dandynaufaldi commented Jan 27, 2026

Summary by CodeRabbit

  • New Features

    • Added option to exclude specific gRPC status codes from triggering Hystrix fallbacks, allowing finer-grained control over error handling.
  • Documentation

    • Updated README links to reflect current source references.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Documentation
README.md
Updated line-numbered links to match current source file positions; purely presentational.
Hystrix status exclusion
options.go, interceptors.go
Added excludedCodes []codes.Code to clientOptions and new public constructor WithHystrixExcludedCodes(grpcCodes ...codes.Code). Interceptor now parses gRPC status errors (google.golang.org/grpc/status) and, if the status code is in excludedCodes, returns nil to bypass Hystrix fallback; otherwise returns the original error.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰✨ I nibble on code beneath the moonlight,
Status codes chosen, some take flight,
Hystrix pausing for errors we name,
Quiet circuits, gentler game. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main feature being added: support for excluding gRPC status codes from Hystrix error handling. It matches the core functionality changes across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #14

coderabbitai bot added a commit that referenced this pull request Jan 27, 2026
Docstrings generation was requested by @ankurs.

* #13 (comment)

The following files were modified:

* `interceptors.go`
* `options.go`
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 WithHystrixExcludedCodes option 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>
@ankurs ankurs merged commit ce9ccf2 into go-coldbrew:main Jan 27, 2026
3 checks passed
ankurs added a commit that referenced this pull request Jan 27, 2026
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>
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.

2 participants