From: Darold Gilles Date: Fri, 22 Aug 2014 13:19:14 +0000 (+0200) Subject: Add -B or --bar-graph command line option to use bar instead of line in graph. Thanks... X-Git-Tag: v6.1~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6ed730f00c588471f23b10f3442242ba656c2b49;p=pgbadger Add -B or --bar-graph command line option to use bar instead of line in graph. Thanks to Bart Dopheide for the suggestion. Also fix Checkpoint Wal files usage graph title. --- diff --git a/README b/README index 03b06bc..71a1488 100644 --- a/README +++ b/README @@ -19,6 +19,7 @@ SYNOPSIS -A | --histo-avg minutes: number of minutes to build the histogram graphs of queries. Default 60 minutes. -b | --begin datetime : start date/time for the data to be parsed in log. + -B | --bar-graph : use bar graph instead of line by default. -c | --dbclient host : only report on entries for the given client host. -C | --nocomment : remove comments like /* ... */ from queries. -d | --dbname database : only report on entries for the given database. diff --git a/doc/pgBadger.pod b/doc/pgBadger.pod index 21d8c09..88d7ce1 100644 --- a/doc/pgBadger.pod +++ b/doc/pgBadger.pod @@ -21,6 +21,7 @@ Options: -A | --histo-avg minutes: number of minutes to build the histogram graphs of queries. Default 60 minutes. -b | --begin datetime : start date/time for the data to be parsed in log. + -B | --bar-graph : use bar graph instead of line by default. -c | --dbclient host : only report on entries for the given client host. -C | --nocomment : remove comments like /* ... */ from queries. -d | --dbname database : only report on entries for the given database. diff --git a/pgbadger b/pgbadger index dbb5661..fe9dbc5 100755 --- a/pgbadger +++ b/pgbadger @@ -222,6 +222,7 @@ my $last_incr_date = ''; my $anonymize = 0; my $noclean = 0; my $retention = 0; +my $bar_graph = 0; my $NUMPROGRESS = 10000; my @DIMENSIONS = (800, 300); @@ -301,6 +302,7 @@ my $result = GetOptions( "a|average=i" => \$avg_minutes, "A|histo-average=i" => \$histo_avg_minutes, "b|begin=s" => \$from, + "B|bar-graph!" => \$bar_graph, "c|dbclient=s" => \@dbclient, "C|nocomment!" => \$remove_comment, "d|dbname=s" => \@dbname, @@ -1536,6 +1538,7 @@ Options: -A | --histo-avg minutes: number of minutes to build the histogram graphs of queries. Default 60 minutes. -b | --begin datetime : start date/time for the data to be parsed in log. + -B | --bar-graph : use bar graph instead of line by default. -c | --dbclient host : only report on entries for the given client host. -C | --nocomment : remove comments like /* ... */ from queries. -d | --dbname database : only report on entries for the given database. @@ -5114,7 +5117,7 @@ sub print_checkpoint ); $drawn_graphs{checkpointfiles_graph} = &flotr2_graph($graphid++, 'checkpointfiles_graph', $graph_data{file_added}, - $graph_data{file_removed}, $graph_data{file_recycled}, 'Checkpoint Wal files usage', + $graph_data{file_removed}, $graph_data{file_recycled}, 'Checkpoint Wal files usage (' . $avg_minutes . ' minutes period)', 'Number of files', 'Added', 'Removed', 'Recycled' ); @@ -5170,7 +5173,7 @@ $drawn_graphs{checkpointwritebuffers_graph}
-

Checkpoint Wal files usage

+

Checkpoint Wal files usage ($avg_minutes minutes average)

$drawn_graphs{checkpointfiles_graph}
@@ -9902,6 +9905,18 @@ sub flotr2_graph $type = 'duration'; } + my $barwidth = $avg_minutes * 60 * 1000; + my $bar_def = ''; + if ($bar_graph) { + $bar_def = qq{ + bars: { + show: true, + horizontal: false, + shadowSize: 0, + barWidth: $barwidth, + }, +}; + } return <