Skip to content

Commit

Permalink
#1079 set alert info into a blockqueue
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsun314 committed Apr 1, 2019
1 parent da14022 commit 5928f67
Show file tree
Hide file tree
Showing 28 changed files with 1,278 additions and 160 deletions.
1 change: 1 addition & 0 deletions dble_checkstyle_suppression.xml
Expand Up @@ -13,6 +13,7 @@
<suppress checks=".*" files="StructureMeta.java"/>
<suppress checks=".*" files="UcoreInterface.java"/>
<suppress checks=".*" files="UcoreGrpc.java"/>
<suppress checks=".*" files="AlertBlockQueue.java"/>
<suppress checks=".*" files="UshardInterface.java"/>
<suppress checks=".*" files="DbleClusterGrpc.java"/>
<suppress checks="Indentation" files="MyTime.java"/>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/actiontech/dble/DbleServer.java
Expand Up @@ -36,6 +36,7 @@
import com.actiontech.dble.route.RouteService;
import com.actiontech.dble.route.sequence.handler.*;
import com.actiontech.dble.server.ServerConnectionFactory;
import com.actiontech.dble.server.status.AlertManager;
import com.actiontech.dble.server.status.OnlineLockStatus;
import com.actiontech.dble.server.status.SlowQueryLog;
import com.actiontech.dble.server.util.GlobalTableUtil;
Expand Down Expand Up @@ -364,10 +365,10 @@ public void startup() throws IOException {
if (system.getEnableSlowLog() == 1) {
SlowQueryLog.getInstance().setEnableSlowLog(true);
}
AlertUtil.initAlert();
if (system.getEnableAlert() == 1) {
AlertUtil.switchAlert(true);
}
AlertManager.getInstance().startAlert();
if (aio) {
int processorCount = frontProcessorCount + backendProcessorCount;
LOGGER.info("using aio network handler ");
Expand Down
19 changes: 14 additions & 5 deletions src/main/java/com/actiontech/dble/alarm/Alert.java
Expand Up @@ -5,14 +5,23 @@

package com.actiontech.dble.alarm;

import java.util.Map;
import com.actiontech.dble.cluster.bean.ClusterAlertBean;


public interface Alert {
enum AlertLevel {
NOTICE, WARN, CRITICAL
}
void alertSelf(String code, AlertLevel level, String desc, Map<String, String> labels);
void alert(String code, AlertLevel level, String desc, String alertComponentType, String alertComponentId, Map<String, String> labels);
boolean alertResolve(String code, AlertLevel level, String alertComponentType, String alertComponentId, Map<String, String> labels);
boolean alertSelfResolve(String code, AlertLevel level, Map<String, String> labels);

enum AlertType {
ALERT, ALERT_RESOLVE, ALERT_SELF, ALERT_SELF_RESOLVE
}

void alertSelf(ClusterAlertBean bean);

void alert(ClusterAlertBean bean);

boolean alertResolve(ClusterAlertBean bean);

boolean alertSelfResolve(ClusterAlertBean bean);
}

0 comments on commit 5928f67

Please sign in to comment.