[Why]
With template compare mode, it's not friendly for echart that
return null for nil standard_deviation of a metric like:
{
"tables": {
"vmstat.system.cs": {
"standard_deviation": {
"dimensions": ["compare_dimension", "openeuler 20.03"],
"source": [
["4G", "8G", "16G"],
["openeuler 20.03", 23, null, null]
]
}
}
}
}
[How]
fill 0 for nil standard_deviation, instead of "null"
Signed-off-by: Lu Weitao <luweitaobe(a)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 1550435..dd9b86e 100644
--- a/lib/compare_matrixes.rb
+++ b/lib/compare_matrixes.rb
@@ -461,7 +461,7 @@ def assign_metric_values(metrics_values, dim, metric, values)
metrics_values[metric]['standard_deviation'] ||= {}
metric_value = get_values(values, true)
metrics_values[metric]['average'][dim] = metric_value[:average]
- metrics_values[metric]['standard_deviation'][dim] = metric_value[:stddev]
+ metrics_values[metric]['standard_deviation'][dim] = metric_value[:stddev] || 0
end
def assign_metric_change(metrics_values)
--
2.23.0