public AlertHistoryDetailed buildAlertHistoryDetailed()

in ozhera-monitor/ozhera-monitor-service/src/main/java/org/apache/ozhera/monitor/service/helper/AlertHelper.java [226:284]


    public AlertHistoryDetailed buildAlertHistoryDetailed(JsonObject data) {
        AlertHistoryDetailed detailed = new AlertHistoryDetailed();
        if (data.has("id")) {
            detailed.setId(data.get("id").getAsString());
        }
        if (data.has("alert_id")) {
            detailed.setAlertId(data.get("alert_id").getAsString());
        }
        if (data.has("tree_id")) {
            detailed.setIamTreeId(data.get("tree_id").getAsInt());
        }
        if (data.has("alert_name")) {
            detailed.setAlertName(data.get("alert_name").getAsString());
        }
        if (data.has("alert_cname")) {
            detailed.setAlertCName(data.get("alert_cname").getAsString());
        }
        if (data.has("alert_time")) {
            detailed.setAlertDate(CommonUtil.toMillis(data.get("alert_time").getAsLong()));
        }
        if (data.has("priority")) {
            detailed.setAlertLevel(data.get("priority").getAsString());
        }
        //resolved firing
        if (data.has("status")) {
            detailed.setAlertStat(data.get("status").getAsString());
        }
        if (data.has("end_time")) {
            detailed.setAlertEndTime(CommonUtil.toMillis(data.get("end_time").getAsLong()));
        }
        if (data.has("start_time")) {
            detailed.setAlertStartTime(CommonUtil.toMillis(data.get("start_time").getAsLong()));
        }
        detailed.setDurationTime(buildDurationTime(data));
        if (data.has("labels")) {
            JsonObject labels = data.get("labels").getAsJsonObject();
            StringBuilder content = new StringBuilder();
            buildAlertContent(content, labels);
            buildDataCountContent(content, labels);
            buildAlarmSendInterval(content, labels);
            detailed.setAlertContent(content.toString());
            if (labels.has("project_name")) {
                detailed.setAlertApp(labels.get("project_name").getAsString());
            }
            if (labels.has("project_id")) {
                detailed.setAlertAppId(labels.get("project_id").getAsString());
            }
            if (labels.has("instance")) {
                detailed.setAlertIntance(labels.get("instance").getAsString());
            }
            if (labels.has("ip")) {
                detailed.setAlertIp(labels.get("ip").getAsString());
            }
            if (labels.has("serverIp")) {
                detailed.setAlertIp(labels.get("serverIp").getAsString());
            }
        }
        return detailed;
    }