public List<AlarmMessage> check() {
        List<AlarmMessage> alarmMessageList = new ArrayList<>(30);
        List<AlarmEntity> expiredEntityList = new ArrayList<>();

        windows.forEach((alarmEntity, window) -> {
            if (window.isExpired()) {
                expiredEntityList.add(alarmEntity);
                return;
            }

            Optional<AlarmMessage> alarmMessageOptional = window.checkAlarm();
            if (alarmMessageOptional.isPresent()) {
                AlarmMessage alarmMessage = alarmMessageOptional.get();
                alarmMessage.setScopeId(alarmEntity.getScopeId());
                alarmMessage.setScope(alarmEntity.getScope());
                alarmMessage.setName(alarmEntity.getName());
                alarmMessage.setId0(alarmEntity.getId0());
                alarmMessage.setId1(alarmEntity.getId1());
                alarmMessage.setRuleName(this.ruleName);
                alarmMessage.setAlarmMessage(formatter.format(alarmEntity));
                alarmMessage.setStartTime(System.currentTimeMillis());
                alarmMessage.setPeriod(this.period);
                alarmMessage.setTags(this.tags);
                alarmMessage.setHooks(this.hooks);
                alarmMessage.setExpression(expression);
                alarmMessage.setMqeMetricsSnapshot(window.mqeMetricsSnapshot);
                alarmMessageList.add(alarmMessage);
            }
        });

        expiredEntityList.forEach(windows::remove);
        return alarmMessageList;
    }
Check the conditions, decide to whether trigger alarm.
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java