diff --git a/bin/pt-agent b/bin/pt-agent index dfe279af..f6fe07b0 100755 --- a/bin/pt-agent +++ b/bin/pt-agent @@ -5891,26 +5891,24 @@ sub start_agent { $logger->info('Starting agent'); # Daemonize first so all output goes to the --log. - my $daemon; - if ( $daemonize ) { - $daemon = Daemon->new( - daemonize => $daemonize, - pid_file => $pid_file, - log_file => $log_file, - parent_exit => sub { - my $child_pid = shift; - print "pt-agent has daemonized and is running as PID $child_pid: + my $daemon = Daemon->new( + daemonize => $daemonize, + pid_file => $pid_file, + log_file => $log_file, + parent_exit => sub { + my $child_pid = shift; + print "pt-agent has daemonized and is running as PID $child_pid: - --lib " . ($lib_dir || '') . " - --log " . ($log_file || '') . " - --pid " . ($pid_file || '') . " + --lib " . ($lib_dir || '') . " + --log " . ($log_file || '') . " + --pid " . ($pid_file || '') . " These values can change if a different configuration is received. ", - } - ); - $daemon->run(); - + } + ); + $daemon->run(); + if ( $daemonize ) { # If we daemonized, the parent has already exited and we're the child. # We shared a copy of every Cxn with the parent, and the parent's copies # were destroyed but the dbhs were not disconnected because the parent diff --git a/t/pt-agent/samples/query-history/data001.json b/t/pt-agent/samples/query-history/data001.json index 7f3d8972..024b657d 100644 --- a/t/pt-agent/samples/query-history/data001.json +++ b/t/pt-agent/samples/query-history/data001.json @@ -10,6 +10,18 @@ "ts" : null }, "fingerprint" : "select min(id),max(id) from tbl", + "histograms" : { + "Query_time" : [ + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0 + ] + }, "metrics" : { "Lock_time" : { "avg" : "0.009453",