From e50e3f7be4013062f0df507f65626fdbf8058442 Mon Sep 17 00:00:00 2001 From: Gilles Darold Date: Mon, 17 Dec 2018 21:42:04 +0100 Subject: [PATCH] Add Checkpoints distance key/value for distance peak. --- pgbadger | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pgbadger b/pgbadger index f58b89b..8e79189 100755 --- a/pgbadger +++ b/pgbadger @@ -7692,6 +7692,13 @@ sub print_checkpoint $walfile_usage_peak_date = $_; last; } + my $checkpoint_distance_peak = 0; + my $checkpoint_distance_peak_date = ''; + foreach (sort {$overall_checkpoint{'peak'}{$b}{distance} <=> $overall_checkpoint{'peak'}{$a}{distance}} keys %{$overall_checkpoint{'peak'}}) { + $checkpoint_distance_peak = &comma_numbers(sprintf("%.2f", $overall_checkpoint{'peak'}{$_}{distance}/1024)); + $checkpoint_distance_peak_date = $_; + last; + } print $fh qq{

Checkpoints / Restartpoints

@@ -7742,6 +7749,8 @@ $drawn_graphs{checkpointfiles_graph}

Key values

@@ -11833,6 +11842,8 @@ sub load_stats foreach my $k (keys %{$_overall_checkpoint{peak}}) { $overall_checkpoint{peak}{$k}{checkpoint_wbuffer} += $_overall_checkpoint{peak}{$k}{checkpoint_wbuffer}; $overall_checkpoint{peak}{$k}{walfile_usage} += $_overall_checkpoint{peak}{$k}{walfile_usage}; + $overall_checkpoint{peak}{$k}{distance} += $_overall_checkpoint{peak}{$k}{distance}; + $overall_checkpoint{peak}{$k}{estimate} += $_overall_checkpoint{peak}{$k}{estimate}; } ### pgbouncer related overall stats ### @@ -13192,6 +13203,8 @@ sub parse_query if ($prefix_vars{'t_query'} =~ /; distance=(\d+) kB, estimate=(\d+) kB/) { $checkpoint_info{distance} += $1; $checkpoint_info{estimate} += $2; + $overall_checkpoint{'peak'}{$cur_last_log_timestamp}{distance} += $1; + $overall_checkpoint{'peak'}{$cur_last_log_timestamp}{estimate} += $1; if ($1 > $overall_checkpoint{distance}) { $overall_checkpoint{distance} = $1; } -- 2.40.0