~percona-toolkit-dev/percona-toolkit/release-2.2.4

« back to all changes in this revision

Viewing changes to bin/pt-query-digest

  • Committer: Daniel Nichter
  • Date: 2013-07-01 21:06:43 UTC
  • mfrom: (599.1.3 pqd-json-anon)
  • Revision ID: daniel@percona.com-20130701210643-6lcbkagocbrd6nma
Merge pqd-json-anon.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7900
7900
         distillate  => $distill,
7901
7901
         attribute   => $groupby,
7902
7902
         query_count => $times_seen,
7903
 
         example     => {
7904
 
            query => substr($sample->{arg}, 0, $self->max_query_length),
7905
 
            ts    => $sample->{ts} ? parse_timestamp($sample->{ts}) : undef,
7906
 
         },
 
7903
         $args{anon} ? () : (
 
7904
            example     => {
 
7905
               query => substr($sample->{arg}, 0, $self->max_query_length),
 
7906
               ts    => $sample->{ts} ? parse_timestamp($sample->{ts}) : undef,
 
7907
            },
 
7908
         ),
7907
7909
      };
7908
7910
 
7909
7911
      my %metrics;
7981
7983
            push @tables, { status => $status, create => $create };
7982
7984
         }
7983
7985
 
7984
 
         if ( $item =~ m/^(?:[\(\s]*select|insert|replace)/ ) {
7985
 
            if ( $item =~ m/^(?:insert|replace)/ ) {
 
7986
         if ( !$args{anon} ) {
 
7987
            if ( $item =~ m/^(?:[\(\s]*select|insert|replace)/ ) {
 
7988
               if ( $item =~ m/^(?:insert|replace)/ ) {
 
7989
               }
 
7990
               else {
 
7991
 
 
7992
               }
7986
7993
            }
7987
7994
            else {
7988
 
 
7989
 
            }
7990
 
         }
7991
 
         else {
7992
 
            my $converted = $qr->convert_to_select(
7993
 
               $sample->{arg} || '',
7994
 
            );
7995
 
            if ( $converted && $converted =~ m/^[\(\s]*select/i ) {
7996
 
               $class->{example}->{as_select} = $converted;
 
7995
               my $converted = $qr->convert_to_select(
 
7996
                  $sample->{arg} || '',
 
7997
               );
 
7998
               if ( $converted && $converted =~ m/^[\(\s]*select/i ) {
 
7999
                  $class->{example}->{as_select} = $converted;
 
8000
               }
7997
8001
            }
7998
8002
         }
7999
8003
      }
14155
14159
            $print_header = 1;
14156
14160
         }
14157
14161
 
14158
 
         my $report_class = $o->get('output') =~ m/\Ajson\z/i
 
14162
         my $report_class = $o->get('output') =~ m/^json/i
14159
14163
                          ? 'JSONReportFormatter'
14160
14164
                          : 'QueryReportFormatter';
14161
14165
         my $qrf = $report_class->new(
14182
14186
            variations   => $o->get('variations'),
14183
14187
            group        => { map { $_=>1 } qw(rusage date hostname files header) },
14184
14188
            resume       => $resume,
 
14189
            anon         => $o->get('output') eq 'json-anon',
14185
14190
         );
14186
14191
      }
14187
14192
 
15611
15616
 
15612
15617
How to format and print the query analysis results.  Accepted values are:
15613
15618
 
15614
 
   VALUE    FORMAT
15615
 
   =======  ==============================
15616
 
   report   Standard query analysis report
15617
 
   slowlog  MySQL slow log
15618
 
   json     JSON, on array per query class
 
15619
   VALUE      FORMAT
 
15620
   =======    ==============================
 
15621
   report     Standard query analysis report
 
15622
   slowlog    MySQL slow log
 
15623
   json       JSON, on array per query class
 
15624
   json-anon  JSON without example queries
15619
15625
 
15620
15626
The entire C<report> output can be disabled by specifying C<--no-report>
15621
15627
(see L<"--[no]report">), and its sections can be disabled or rearranged