all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-cluster] fix #6615: rrd: only return populated entries
@ 2025-08-08 14:16 Hannes Laimer
  2025-08-08 14:55 ` Fabian Grünbichler
  2025-08-08 15:08 ` [pve-devel] superseded: " Hannes Laimer
  0 siblings, 2 replies; 4+ messages in thread
From: Hannes Laimer @ 2025-08-08 14:16 UTC (permalink / raw)
  To: pve-devel

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@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;
     }
 
     return $res;
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH pve-cluster] fix #6615: rrd: only return populated entries
  2025-08-08 14:16 [pve-devel] [PATCH pve-cluster] fix #6615: rrd: only return populated entries Hannes Laimer
@ 2025-08-08 14:55 ` Fabian Grünbichler
  2025-08-08 15:05   ` Hannes Laimer
  2025-08-08 15:08 ` [pve-devel] superseded: " Hannes Laimer
  1 sibling, 1 reply; 4+ messages in thread
From: Fabian Grünbichler @ 2025-08-08 14:55 UTC (permalink / raw)
  To: Proxmox VE development discussion

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@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@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH pve-cluster] fix #6615: rrd: only return populated entries
  2025-08-08 14:55 ` Fabian Grünbichler
@ 2025-08-08 15:05   ` Hannes Laimer
  0 siblings, 0 replies; 4+ messages in thread
From: Hannes Laimer @ 2025-08-08 15:05 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Grünbichler



On 08.08.25 16:55, Fabian Grünbichler wrote:
> 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@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?
> 

we could, and assuming the structure of the entries won't change, we
probably also should :)

I'll send a v2

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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] superseded: [PATCH pve-cluster] fix #6615: rrd: only return populated entries
  2025-08-08 14:16 [pve-devel] [PATCH pve-cluster] fix #6615: rrd: only return populated entries Hannes Laimer
  2025-08-08 14:55 ` Fabian Grünbichler
@ 2025-08-08 15:08 ` Hannes Laimer
  1 sibling, 0 replies; 4+ messages in thread
From: Hannes Laimer @ 2025-08-08 15:08 UTC (permalink / raw)
  To: pve-devel

superseded-by: 
https://lore.proxmox.com/pve-devel/20250808150814.110051-1-h.laimer@proxmox.com/T/#u

On 08.08.25 16:16, 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@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;
>       }
>   
>       return $res;



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-08 15:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-08 14:16 [pve-devel] [PATCH pve-cluster] fix #6615: rrd: only return populated entries Hannes Laimer
2025-08-08 14:55 ` Fabian Grünbichler
2025-08-08 15:05   ` Hannes Laimer
2025-08-08 15:08 ` [pve-devel] superseded: " Hannes Laimer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal