mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
Add --output json-anon that excludes query examples.
This commit is contained in:
@@ -7900,10 +7900,12 @@ override query_report => sub {
|
||||
distillate => $distill,
|
||||
attribute => $groupby,
|
||||
query_count => $times_seen,
|
||||
$args{anon} ? () : (
|
||||
example => {
|
||||
query => substr($sample->{arg}, 0, $self->max_query_length),
|
||||
ts => $sample->{ts} ? parse_timestamp($sample->{ts}) : undef,
|
||||
},
|
||||
),
|
||||
};
|
||||
|
||||
my %metrics;
|
||||
@@ -14155,7 +14157,7 @@ sub print_reports {
|
||||
$print_header = 1;
|
||||
}
|
||||
|
||||
my $report_class = $o->get('output') =~ m/\Ajson\z/i
|
||||
my $report_class = $o->get('output') =~ m/^json/i
|
||||
? 'JSONReportFormatter'
|
||||
: 'QueryReportFormatter';
|
||||
my $qrf = $report_class->new(
|
||||
@@ -14182,6 +14184,7 @@ sub print_reports {
|
||||
variations => $o->get('variations'),
|
||||
group => { map { $_=>1 } qw(rusage date hostname files header) },
|
||||
resume => $resume,
|
||||
anon => $report_class eq 'json-anon',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15616,6 +15619,7 @@ How to format and print the query analysis results. Accepted values are:
|
||||
report Standard query analysis report
|
||||
slowlog MySQL slow log
|
||||
json JSON, on array per query class
|
||||
json-anon JSON without example queries
|
||||
|
||||
The entire C<report> output can be disabled by specifying C<--no-report>
|
||||
(see L<"--[no]report">), and its sections can be disabled or rearranged
|
||||
|
@@ -228,10 +228,12 @@ override query_report => sub {
|
||||
distillate => $distill,
|
||||
attribute => $groupby,
|
||||
query_count => $times_seen,
|
||||
$args{anon} ? () : (
|
||||
example => {
|
||||
query => substr($sample->{arg}, 0, $self->max_query_length),
|
||||
ts => $sample->{ts} ? parse_timestamp($sample->{ts}) : undef,
|
||||
},
|
||||
),
|
||||
};
|
||||
|
||||
my %metrics;
|
||||
|
@@ -33,7 +33,8 @@ ok(
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_query_digest::main(@args, "$sample/slowlogs/slow002.txt") },
|
||||
"$results/output_json_slow002.txt"
|
||||
"$results/output_json_slow002.txt",
|
||||
sed => [ qq/'s!$trunk!TRUNK!'/ ],
|
||||
),
|
||||
'json output for slow002'
|
||||
) or diag($test_diff);
|
||||
@@ -45,6 +46,7 @@ ok(
|
||||
sub { pt_query_digest::main(qw(--type tcpdump --limit 10 --watch-server 127.0.0.1:12345),
|
||||
@args, "$sample/tcpdump/tcpdump021.txt") },
|
||||
"$results/output_json_tcpdump021.txt",
|
||||
sed => [ qq/'s!$trunk!TRUNK!'/ ],
|
||||
),
|
||||
'json output for for tcpdump021',
|
||||
) or diag($test_diff);
|
||||
|
@@ -1,2 +0,0 @@
|
||||
|
||||
# No events processed.
|
||||
|
@@ -121,7 +121,7 @@
|
||||
"global" : {
|
||||
"files" : [
|
||||
{
|
||||
"name" : "/Users/daniel/p/release-2.2.3/t/lib/samples/slowlogs/slow002.txt",
|
||||
"name" : "TRUNK/t/lib/samples/slowlogs/slow002.txt",
|
||||
"size" : 3841
|
||||
}
|
||||
],
|
||||
|
@@ -187,7 +187,7 @@
|
||||
"global" : {
|
||||
"files" : [
|
||||
{
|
||||
"name" : "/Users/daniel/p/release-2.2.3/t/lib/samples/tcpdump/tcpdump021.txt",
|
||||
"name" : "TRUNK/t/lib/samples/tcpdump/tcpdump021.txt",
|
||||
"size" : 2827
|
||||
}
|
||||
],
|
||||
|
Reference in New Issue
Block a user