[pve-devel] [PATCH pve-cluster] fix #6615: rrd: only return populated entries

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Aug 8 16:55:09 CEST 2025


On August 8, 2025 4:16 pm, Hannes Laimer wrote:
> RRD fetch can include the latest bucket before metrics are flushed,
> resulting in entries with only a timestamp.
> 
> This now only returns entries with at least one value.
> 
> Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
> ---
>  src/PVE/RRD.pm | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/PVE/RRD.pm b/src/PVE/RRD.pm
> index 8fe1927..41737ee 100644
> --- a/src/PVE/RRD.pm
> +++ b/src/PVE/RRD.pm
> @@ -67,10 +67,12 @@ sub create_rrd_data {
>      for my $line (@$data) {
>          my $entry = { 'time' => $start };
>          $start += $step;
> +        my $has_value = 0;
>          for (my $i = 0; $i < $fields; $i++) {
>              my $name = $names->[$i];
>              if (defined(my $val = $line->[$i])) {
>                  $entry->{$name} = $val;
> +                $has_value = 1 if !$has_value;
>                  $entry->{memavailable} = $val
>                      if $is_node && $name eq 'memfree' && !exists($entry->{memavailable});
>              } else {
> @@ -78,7 +80,8 @@ sub create_rrd_data {
>                  # maybe make this configurable?
>              }
>          }
> -        push @$res, $entry;
> +        # Do not return entries that only contain 'time' without any metric values
> +        push @$res, $entry if $has_value;

nit: this could just check that $entry has more than one key?

>      }
>  
>      return $res;
> -- 
> 2.47.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 




More information about the pve-devel mailing list