LEILEI0628 opened a new pull request, #876: URL: https://github.com/apache/dubbo-go-pixiu/pull/876
<!-- Thanks for sending a pull request! --> **What this PR does**: This PR fixes the circuit breaker feedback loop implementation in the Sentinel circuit breaker filter. The circuit breaker now correctly transitions to OPEN state when backend services return errors or slow responses. **Key changes**: - Modified `Decode()` to store Sentinel entry in HttpContext instead of immediately calling `Exit()` - Implemented `Encode()` method to handle response processing and error reporting - Entry-Exit lifecycle now brackets the complete request lifecycle for accurate latency and error statistics - Circuit breaker now correctly detects error ratios and slow request ratios **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. _If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_* --> Fixes #869 **Special notes for your reviewer**: **Root Cause Analysis**: The original implementation called `entry.Exit()` in the Decode phase (before backend response), causing Sentinel to perceive all requests as successful and instantaneous. The filter lacked error and latency reporting to Sentinel's state machine. **Testing**: - Added comprehensive test suite with 7 test cases in `TestCircuitBreakerFeedbackLoop` - All existing tests continue to pass - Tested error ratio detection, slow request detection, and circuit breaker state transitions **Backward Compatibility**: This change is fully backward compatible. The fix only adds the missing functionality without changing the public API or configuration format. **Does this PR introduce a user-facing change?**: <!-- If no, just write "NONE" in the release-note block below. If yes, a release note is required: Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required". --> ```release-note fix(circuitbreaker): Circuit breaker now correctly detects backend errors and slow responses. The circuit breaker will properly transition to OPEN state based on configured error ratio or slow request ratio thresholds, providing effective service protection. ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
