mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-26 15:31:55 +00:00
Update JSONReportFormatter: report all str attribs; don't print "# No events processed" since that's not valid JSON; rename output.t to json.t.
This commit is contained in:
@@ -1,3 +1,22 @@
|
||||
# This program is copyright 2013 Percona Ireland Ltd.
|
||||
# Feedback and improvements are welcome.
|
||||
#
|
||||
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation, version 2; OR the Perl Artistic License. On UNIX and similar
|
||||
# systems, you can issue `man perlgpl' or `man perlartistic' to read these
|
||||
# licenses.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
# Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
# ###########################################################################
|
||||
# JSONReportFormatter package
|
||||
# ###########################################################################
|
||||
{
|
||||
package JSONReportFormatter;
|
||||
use Lmo;
|
||||
@@ -57,8 +76,6 @@ override query_report => sub {
|
||||
|
||||
my @attribs = @{$ea->get_attributes()};
|
||||
|
||||
my %string_args = map { $_ => 1 } qw( db host arg user bytes pos_in_log );
|
||||
|
||||
my @queries;
|
||||
foreach my $worst_info ( @$worst ) {
|
||||
my $item = $worst_info->[0];
|
||||
@@ -98,7 +115,7 @@ override query_report => sub {
|
||||
$class{ts_min} = $ts->{min};
|
||||
$class{ts_max} = $ts->{max};
|
||||
}
|
||||
elsif ( $string_args{$attrib} ) {
|
||||
elsif ( ($ea->{type_for}->{$attrib} || '') eq 'str' ) {
|
||||
$metrics{$attrib} = { value => $metrics{$attrib}{max} };
|
||||
}
|
||||
elsif ( ($ea->{type_for}->{$attrib} || '') eq 'num' ) {
|
||||
@@ -128,3 +145,6 @@ override query_report => sub {
|
||||
no Lmo;
|
||||
1;
|
||||
}
|
||||
# ###########################################################################
|
||||
# End JSONReportFormatter package
|
||||
# ###########################################################################
|
||||
|
@@ -28,7 +28,7 @@ ok(
|
||||
"$results/empty_report.txt",
|
||||
),
|
||||
'json output for empty log'
|
||||
);
|
||||
) or diag($test_diff);
|
||||
|
||||
ok(
|
||||
no_diff(
|
@@ -1,2 +0,0 @@
|
||||
|
||||
# No events processed.
|
||||
|
Reference in New Issue
Block a user