On Thu, Nov 26, 2020 at 09:20:17AM +0800, Lu Weitao wrote:
[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"
You can say "fill 0 if standard_deviation is nil."
Thanks, Xueliang
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 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