Explore a unified schema structure for CI reports
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
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 endThat would keep us from polluting the
Gitlab::Ci::Metrics::Metricwith values from other reports. And it gives us a placeReportedMetricto implement extra logic when we introduce bias.
Edited by 🤖 GitLab Bot 🤖