wujimin commented on a change in pull request #678: [SCB-506]服务治理相关的需要事件上报
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/678#discussion_r185533065
 
 

 ##########
 File path: 
handlers/handler-bizkeeper/src/main/java/org/apache/servicecomb/bizkeeper/BizkeeperHandler.java
 ##########
 @@ -82,6 +92,25 @@ public void handle(Invocation invocation, AsyncResponse 
asyncResp) {
     });
   }
 
+  /**
+   * 使用circuitMarker来记录被熔断的接口
+   * 判断熔断开启或关闭,如果之前没有发送过告警信息才会发送告警
+   */
+  private void eventAlarm(Invocation invocation) {
+    HystrixCommandKey commandKey = CommandKey.toHystrixCommandKey(groupname, 
invocation);
+    HystrixCircuitBreaker circuitBreaker =
+        HystrixCircuitBreaker.Factory.getInstance(commandKey);
+    String microserviceQualifiedName = 
invocation.getMicroserviceQualifiedName();
+    if (circuitBreaker != null && circuitBreaker.isOpen() && 
circuitMarker.get(microserviceQualifiedName) == null) {
+      EventManager.post(new CircutBreakerEvent(invocation, commandKey, 
this.groupname, Type.OPEN));
+      circuitMarker.put(microserviceQualifiedName, true);
+    } else if (circuitBreaker != null && !circuitBreaker.isOpen()
+        && circuitMarker.get(microserviceQualifiedName) != null) {
+      EventManager.post(new CircutBreakerEvent(invocation, commandKey, 
this.groupname, Type.CLOSE));
 
 Review comment:
   even circuitMarker no concurrency problem
   this logic is not good.
   
   multi threads run if conditions and got true, then all run into post and 
remove logic.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to