[pve-devel] [PATCH cluster] allow empty values in rrddata

Dominik Csapak d.csapak at proxmox.com
Thu Mar 24 15:24:34 CET 2016


since the charts plugin in extjs6 behaves correctly
when some values are missing,
we can allow empty fields in the rrddata response

if we do not do this, we have to manually insert
empty values on the client side to correctly show
the graphs

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
should we make this configureable?
 data/PVE/Cluster.pm | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index 5eabd7c..c21d37c 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -658,18 +658,16 @@ sub create_rrd_data {
     for my $line (@$data) {
 	my $entry = { 'time' => $start };
 	$start += $step;
-	my $found_undefs;
 	for (my $i = 0; $i < $fields; $i++) {
 	    my $name = $names->[$i];
 	    if (defined(my $val = $line->[$i])) {
 		$entry->{$name} = $val;
 	    } else {
-		# we only add entryies with all data defined
-		# extjs chart has problems with undefined values
-		$found_undefs = 1;
+		# leave empty fields undefined
+		# maybe make this configurable?
 	    }
 	}
-	push @$res, $entry if !$found_undefs;
+	push @$res, $entry;
     }
 
     return $res;
-- 
2.1.4





More information about the pve-devel mailing list