In the context of programming language courses, offering early and personalized assistance to students with difficulties in solving code exercises is fundamental to helping them improve their performance. To this end, it is desirable to detect those students with behavioral patterns that could potentially result in poor performance in a timely manner. In this study, we analyze different behavioral metrics for predicting the performance of students in a 2nd-year computer science course. Metrics are extracted from practical sessions, that is, code exercise labs that may be finished online during a period of 5-7 days. In addition to well-known metrics (e.g., the relative time spent solving compilation/execution errors or skills for removing compilation errors), we also incorporate metrics that take into account the work habits of students (e.g., timestamps in which the student has undertaken 25%, 50%, and 75% of the exercise lab) and similarity between codes. With a sample of 224 students from seven different course groups, we construct robust