mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 18:30:16 +00:00
Make some internal values show up nicer in --output json
This commit is contained in:
@@ -9,8 +9,8 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
my $have_json = eval { require JSON };
|
||||
|
||||
our $pretty_json = undef;
|
||||
our $sorted_json = undef;
|
||||
our $pretty_json = 0;
|
||||
our $sorted_json = 0;
|
||||
|
||||
extends qw(QueryReportFormatter);
|
||||
|
||||
@@ -56,6 +56,8 @@ override query_report => sub {
|
||||
my $worst = $args{worst};
|
||||
|
||||
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 ) {
|
||||
@@ -96,6 +98,9 @@ override query_report => sub {
|
||||
$class{ts_min} = $ts->{min};
|
||||
$class{ts_max} = $ts->{max};
|
||||
}
|
||||
elsif ( $string_args{$attrib} ) {
|
||||
$metrics{$attrib} = { value => $metrics{$attrib}{max} };
|
||||
}
|
||||
elsif ( ($ea->{type_for}->{$attrib} || '') eq 'num' ) {
|
||||
# Avoid scientific notation in the metrics by forcing it to use
|
||||
# six decimal places.
|
||||
|
Reference in New Issue
Block a user