public Result selectAppAlarmHealth()

in ozhera-monitor/ozhera-monitor-service/src/main/java/org/apache/ozhera/monitor/service/impl/AppMonitorServiceImpl.java [342:391]


    public Result selectAppAlarmHealth(AlarmHealthQuery query) {
        try {
            List<AlarmHealthResult> alarmHealthResults = appMonitorDao.selectAppHealth(query);
            if (!CollectionUtils.isEmpty(alarmHealthResults)) {
                
                for (AlarmHealthResult alarmHealth : alarmHealthResults) {
                    /**
                     * 基础指标得分
                     */
                    alarmHealth.setBasicMetricScore((alarmHealth.getCpuUseRate().intValue() > 0 ? 2 : 0) + (
                            alarmHealth.getCpuLoad().intValue() > 0 ? 2 : 0) + (
                            alarmHealth.getMemUseRate().intValue() > 0 ? 2 : 0) + (
                            alarmHealth.getContainerNum().intValue() > 0 ? 2 : 0) + (
                            alarmHealth.getJvmThread().intValue() > 0 ? 1 : 0) + (alarmHealth.getJvmGc().intValue() > 0
                            ? 1 : 0));
                    
                    /**
                     * 接口指标得分
                     */
                    alarmHealth.setInterfaceMetricScore(
                            (alarmHealth.getHttpServerAvailability().intValue() > 0 ? 2 : 0) + (
                                    alarmHealth.getHttpServerQps().intValue() > 0 ? 1 : 0) + (
                                    alarmHealth.getHttpServerTimeCost().intValue() > 0 ? 1 : 0) + (
                                    alarmHealth.getHttpClientAvailability().intValue() > 0 ? 1 : 0) + (
                                    alarmHealth.getHttpClientQps().intValue() > 0 ? 1 : 0) + (
                                    alarmHealth.getHttpClientTimeCost().intValue() > 0 ? 1 : 0) + (
                                    alarmHealth.getDubboProviderAvailability().intValue() > 0 ? 2 : 0) + (
                                    alarmHealth.getDubboProviderQps().intValue() > 0 ? 1 : 0) + (
                                    alarmHealth.getDubboProviderTimeCost().intValue() > 0 ? 1 : 0) + (
                                    alarmHealth.getDubboProviderSlowQuery().intValue() > 0 ? 1 : 0) + (
                                    alarmHealth.getDubboConsumerAvailability().intValue() > 0 ? 1 : 0) + (
                                    alarmHealth.getDubboConsumerQps().intValue() > 0 ? 1 : 0) + (
                                    alarmHealth.getDubboConsumerTimeCost().intValue() > 0 ? 1 : 0) + (
                                    alarmHealth.getDubboConsumerSlowQuery().intValue() > 0 ? 1 : 0) + (
                                    alarmHealth.getDbAvailability().intValue() > 0 ? 2 : 0) + (
                                    alarmHealth.getDbSlowQuery().intValue() > 0 ? 1 : 0));
                    
                    /**
                     * 综合得分
                     */
                    alarmHealth.setComprehensiveScore(
                            alarmHealth.getBasicMetricScore() + alarmHealth.getInterfaceMetricScore());
                }
            }
            return Result.success(alarmHealthResults);
        } catch (Exception e) {
            log.error("selectAppAlarmHealth Error!{}", e.getMessage(), e);
            return Result.fail(ErrorCode.unknownError);
        }
    }