public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>,
	"Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-cluster] fix #6615: rrd: only return populated entries
Date: Fri, 8 Aug 2025 17:05:52 +0200	[thread overview]
Message-ID: <0c822495-cede-44b2-89ea-8177099cd49c@proxmox.com> (raw)
In-Reply-To: <1754664827.aua8a1v4ey.astroid@yuna.none>



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

  reply	other threads:[~2025-08-08 15:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-08 14:16 Hannes Laimer
2025-08-08 14:55 ` Fabian Grünbichler
2025-08-08 15:05   ` Hannes Laimer [this message]
2025-08-08 15:08 ` [pve-devel] superseded: " Hannes Laimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0c822495-cede-44b2-89ea-8177099cd49c@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal