From 4a28334f4a7f82f6b186872ba36b4b8fee37554c Mon Sep 17 00:00:00 2001 From: Jonathan Strong Date: Thu, 13 Dec 2018 16:29:42 -0500 Subject: [PATCH] log(InfluxWriter): add msg when recovers from request failure --- src/influx.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/influx.rs b/src/influx.rs index 4c1f300..41e6948 100644 --- a/src/influx.rs +++ b/src/influx.rs @@ -431,7 +431,7 @@ impl InfluxWriter { } let url = url.clone(); // Arc would be faster, but `hyper::Client::post` consumes url let tx = http_tx.clone(); - let thread_logger = logger.new(o!("thread" => "InfluxWriter:http", "n_outstanding" => n_outstanding)); + let thread_logger = logger.new(o!("thread" => "InfluxWriter:http", "n_outstanding" => n_outstanding)); // re `thread_logger` name: disambiguating for `logger` after thread closure let client = Arc::clone(&client); debug!(logger, "launching http thread"); let thread_res = thread::Builder::new().name(format!("inflx-http{}", n_outstanding)).spawn(move || { @@ -462,7 +462,15 @@ impl InfluxWriter { 'b: loop { n_tx += 1; match tx.try_send(resp.take().unwrap()) { - Ok(_) => return, + Ok(_) => { + if n_req > 0 { + info!(logger, "successfully recovered from failed request with retry"; + "n_req" => n_req, + "n_tx" => n_tx, + "elapsed" => %format_args!("{:?}", Instant::now() - start)); + } + return + } Err(chan::TrySendError::Full(r)) => { let throttle = Duration::from_millis(1000) * n_tx;