all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Hannes Laimer <h.laimer@proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-cluster v3] fix #6615: rrd: only return last entry if populated
Date: Wed, 22 Oct 2025 14:17:38 +0200	[thread overview]
Message-ID: <ff8b902b-7d35-4824-a217-728ee0eb55ad@proxmox.com> (raw)
In-Reply-To: <20250827090431.48707-1-h.laimer@proxmox.com>

Am 27.08.25 um 11:04 AM schrieb Hannes Laimer:
> RRD fetch can include the latest bucket before metrics are flushed,
> resulting in entries with only a timestamp.
> 
> This now only returns the last entry if it contains at least one value.
> 
> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>

Tested-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>

With minor style nits below, but could also be applied as is:

> ---
> v3, thanks @Dominik:
>  - only remove last entry if empty, not all empty ones
> 
>  src/PVE/RRD.pm | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/PVE/RRD.pm b/src/PVE/RRD.pm
> index 8fe1927..5a23889 100644
> --- a/src/PVE/RRD.pm
> +++ b/src/PVE/RRD.pm
> @@ -81,6 +81,12 @@ sub create_rrd_data {
>          push @$res, $entry;
>      }
>  
> +    # The newest bucket can still be empty right after a boundary.
> +    if (@$res) {

Style nit: I'd prefer scalar($res->@*) > 0 to be explicit

> +        # only contains 'time'
> +        pop @$res if (scalar(keys %{$res->[-1]}) == 1);

Style nit: we don't usually use parentheses for post-if
Style nit: I'd prefer $res->[-1]->%* so you don't have to mentally keep
track of the % when reading

> +    }
> +
>      return $res;
>  }
>  


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


      reply	other threads:[~2025-10-22 12:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27  9:04 Hannes Laimer
2025-10-22 12:17 ` Fiona Ebner [this message]

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=ff8b902b-7d35-4824-a217-728ee0eb55ad@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=h.laimer@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 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