Show logged steps and a truncation alert in the ML run metrics table
What does this MR do and why?
The Performance table on the ML run page now has one column per logged step, and it shows an info alert when the page leaves out older metric values. Before, the table made one column for every step from 0 to the highest logged step, so a run with a very large step number made the browser build that many columns. The alert reads a metricsTruncated field that the backend MR !263967 adds behind a feature flag; without the field, the page shows no alert.
Design notes
app/assets/javascripts/ml/experiment_tracking/routes/candidates/show/candidate_detail.vue:metricStepsreturns the sorted unique numeric steps of the metrics, andmetricsTableFieldsbuilds one column per step. This applies to every run, with or without the backend flag. A run whose steps have gaps no longer shows empty columns for the missing steps, and a metric whose rows have no step no longer gets an emptyStep 0column.- When
candidate.metricsTruncatedis true, a non-dismissible infoGlAlertabove the table says "This run has more metric values than the page can show. The table shows the most recently logged values." It has no count, because rows without a step and rows that share a step are embedded but not shown. - This MR was split out of !263967, which keeps the backend and database part. The code is the same as the version reviewed there.
- Merge order: either order works. Without the backend MR,
metricsTruncatedis missing, so there is no alert, and the step columns still follow the logged steps. Without this MR, the backend field is unused, and the backend flag is off by default. Merge this MR before the backend flagml_bounded_candidate_metric_readsis enabled. Otherwise a run with more than 1,000 metric values shows empty columns for the steps that the page leaves out.
References
- Related to https://gitlab.com/gitlab-org/gitlab/-/work_items/635040
- Backend and database MR: !263967
Screenshots or screen recordings
A run with 1,201 metric values: num_params at step 0, then loss and accuracy over 600 steps.
| Backend flag off | Backend flag on (with !263967) |
|---|---|
![]() |
![]() |
How to set up and validate locally
-
In the rails console, create a run whose steps have a gap:
project = Project.find_by_full_path('flightjs/Flight'); user = User.find_by_username('root') exp = Ml::Experiment.create!(name: 'logged-steps', project: project, user: user) run = exp.candidates.create!(project: project, user: user); run.metrics.create!([{ name: 'loss', value: 1, step: 0, tracked_at: 0 }, { name: 'loss', value: 0.5, step: 5000, tracked_at: 1 }]) run.iid -
On
master, visithttp://gdk.test:3000/flightjs/Flight/-/ml/candidates/<iid>and open the Performance tab. Expect: columnsStep 0toStep 5000, nearly all empty. -
On this branch, reload the page. Expect: two columns,
Step 0andStep 5000, and no alert.
The alert, with the backend MR
- Check out !263967 together with this branch, and enable the flag:
Feature.enable(:ml_bounded_candidate_metric_reads). - Log more than 1,000 metric values on a run, for example
600.times { |s| run.metrics.create!([{ name: 'loss', value: s, step: s, tracked_at: s }, { name: 'accuracy', value: s, step: s, tracked_at: s }]) }. - Reload the run page. Expect: an info alert above the table and columns only for the steps of the 1,000 most recent values.
Specs: spec/frontend/ml/experiment_tracking/routes/candidates/show/candidate_detail_spec.js covers steps with gaps, rows without a step, no alert without metricsTruncated, and the alert and step columns with it.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

