mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
Report simpler client-side failures to send data. Add ts to metadata to making finding failures in server logs easier.
This commit is contained in:
21
bin/pt-agent
21
bin/pt-agent
@@ -6190,7 +6190,8 @@ sub run_service {
|
|||||||
my $data_file = $prefix . '.' . $service->name . '.data';
|
my $data_file = $prefix . '.' . $service->name . '.data';
|
||||||
my $tmp_data_file = "$tmp_dir/$data_file";
|
my $tmp_data_file = "$tmp_dir/$data_file";
|
||||||
my $taskno = 0;
|
my $taskno = 0;
|
||||||
my $metadata = {};
|
my $metadata = { ts => $prefix };
|
||||||
|
|
||||||
TASK:
|
TASK:
|
||||||
foreach my $task ( @$tasks ) {
|
foreach my $task ( @$tasks ) {
|
||||||
PTDEBUG && _d("Task $taskno:", $task->name);
|
PTDEBUG && _d("Task $taskno:", $task->name);
|
||||||
@@ -6571,9 +6572,21 @@ sub send_data {
|
|||||||
json => $json,
|
json => $json,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( my $e = $EVAL_ERROR ) {
|
||||||
chomp $EVAL_ERROR;
|
if (blessed($e) && $e->isa('Percona::WebAPI::Exception::Request')) {
|
||||||
_warn("Failed to send $data_file: $EVAL_ERROR");
|
my $error_msg;
|
||||||
|
my $content = $client->response->content;
|
||||||
|
if ( $content ) {
|
||||||
|
my $error_hashref = decode_json($content);
|
||||||
|
$error_msg = $error_hashref->{error};
|
||||||
|
}
|
||||||
|
_warn('Error ' . $e->status . " sending $data_file: "
|
||||||
|
. ($error_msg || '(No error error message from server)'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
chomp $e;
|
||||||
|
_warn("Error sending $data_file: $e");
|
||||||
|
}
|
||||||
next DATA_FILE;
|
next DATA_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user