[Why] With template compare mode, it's useless return an empty changes for a metric like: { ... "tables": { "vmstat.system.cs": { ... "change": { "dimensions": [ "compare_dimension" ], "source": [ [ "8G", "16G" ] ] } } }
[How] Skip assign metric change value, if the metric only have one dimension, the empty change will disappear automatically
Signed-off-by: Lu Weitao luweitaobe@163.com --- lib/compare_matrixes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/compare_matrixes.rb b/lib/compare_matrixes.rb index 14c14cb..0b49e59 100644 --- a/lib/compare_matrixes.rb +++ b/lib/compare_matrixes.rb @@ -466,8 +466,8 @@ end
def assign_metric_change(metrics_values) metrics_values.each do |metric, values| - metrics_values[metric]['change'] = {} next if values['average'].size < 2 + metrics_values[metric]['change'] = {}
dimension_list = values['average'].keys dimension_groups = get_dimensions_combination(dimension_list)