Explore a unified schema structure for CI reports

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

@reprazent

Why did we decide to split these up instead of exposing one big array with all entries?

Wouldn't it be easier to expose this roughly like this:

[
  {
    "name": "new metric",
    "value": "100",
    "previous_value": null,
  },
  {
    "name": "existing metric",
    "value": "50",
    "previous_value": "100",
  },
  {
    "name": "removed metric",
    "value": null,
    "previous_value": "200"
  }
]

Then the comparison could be a little simpler since we don't need to iterate so much:

ComparedMetric = Struct(:name, :value, :previous_value)

def metrics
  strong_memoize(:metrics) do
    keys = head_report.keys | base_report.keys
    keys.map do |key|
      name = head_report&.name || base_report&.name
      value = head_report&.value
      previous_value = base_report&.name
     
      ComparedMetric.new(:name, :value, :previous_value)
    end    
  end
end

That would keep us from polluting the Gitlab::Ci::Metrics::Metric with values from other reports. And it gives us a place ReportedMetric to implement extra logic when we introduce bias.

Edited Aug 19, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading