[SCB-506]服务治理相关的需要事件上报#666
Conversation
| @@ -0,0 +1,32 @@ | |||
| package org.apache.servicecomb.loadbalance.event; | |||
| @@ -0,0 +1,27 @@ | |||
| package org.apache.servicecomb.bizkeeper.event; | |||
| @@ -0,0 +1,50 @@ | |||
| package org.apache.servicecomb.bizkeeper.event; | |||
|
You have make some related merge. Please fix it or submit a new one. |
| public enum Type { | ||
| OPEN, | ||
| CLOSE, | ||
| SUCCED, |
There was a problem hiding this comment.
Use SUCCEDED or SUCCESSFUL. When should we use OPEN vs SUCCED?
| HystrixCircuitBreaker circuitBreaker = | ||
| HystrixCircuitBreaker.Factory.getInstance(CommandKey.toHystrixCommandKey(groupname, invocation)); | ||
| if (circuitBreaker != null && circuitBreaker.isOpen()) { | ||
| EventManager.post(new CircutBreakerEvent(invocation, this.groupname, Type.OPEN)); |
There was a problem hiding this comment.
Format your code use code template in /etc folder and it's better to turn on show blanks in your IDE
| public static Response getFallbackResponse(String type, Throwable error, Invocation invocation) { | ||
| FallbackPolicy policy = getPolicy(type, invocation); | ||
| if (policy != null) { | ||
| EventManager.post(new FallbackEvent(policy, invocation, Type.OPEN)); |
There was a problem hiding this comment.
Fallback is called in HystrixCommand, send event there. But I think this will send a lot of unnecessary events because any error will call fallback.
| if (circuitBreaker != null && circuitBreaker.isOpen()) { | ||
| EventManager.post(new CircutBreakerEvent(invocation, this.groupname, Type.OPEN)); | ||
| }else { | ||
| EventManager.post(new CircutBreakerEvent(invocation, this.groupname, Type.CLOSE)); |
There was a problem hiding this comment.
We need only send event when last time is OPEN and turn to be CLOSED. Can't send for each invocation.
Follow this checklist to help us incorporate your contribution quickly and easily:
[SCB-XXX] Fixes bug in ApproximateQuantiles, where you replaceSCB-XXXwith the appropriate JIRA issue.mvn clean installto make sure basic checks pass. A more thorough check will be performed on your pull request automatically.