proxy: promote two logs to error, fix multiline log (#9913)

* Promote two logs from mpsc send errors to error level. The channels
are unbounded and there shouldn't be errors.
* Fix one multiline log from anyhow::Error. Use Debug instead of
Display.
This commit is contained in:
Folke Behrens
2024-11-27 19:05:46 +01:00
committed by GitHub
parent cc37fa0f33
commit 5c41707bee
2 changed files with 12 additions and 8 deletions

View File

@@ -8,7 +8,7 @@ use pq_proto::StartupMessageParams;
use smol_str::SmolStr;
use tokio::sync::mpsc;
use tracing::field::display;
use tracing::{debug, info_span, Span};
use tracing::{debug, error, info_span, Span};
use try_lock::TryLock;
use uuid::Uuid;
@@ -415,9 +415,11 @@ impl RequestContextInner {
});
}
if let Some(tx) = self.sender.take() {
tx.send(RequestData::from(&*self))
.inspect_err(|e| debug!("tx send failed: {e}"))
.ok();
// If type changes, this error handling needs to be updated.
let tx: mpsc::UnboundedSender<RequestData> = tx;
if let Err(e) = tx.send(RequestData::from(&*self)) {
error!("log_connect channel send failed: {e}");
}
}
}
@@ -426,9 +428,11 @@ impl RequestContextInner {
// Here we log the length of the session.
self.disconnect_timestamp = Some(Utc::now());
if let Some(tx) = self.disconnect_sender.take() {
tx.send(RequestData::from(&*self))
.inspect_err(|e| debug!("tx send failed: {e}"))
.ok();
// If type changes, this error handling needs to be updated.
let tx: mpsc::UnboundedSender<RequestData> = tx;
if let Err(e) = tx.send(RequestData::from(&*self)) {
error!("log_disconnect channel send failed: {e}");
}
}
}
}

View File

@@ -398,7 +398,7 @@ async fn upload_parquet(
.err();
if let Some(err) = maybe_err {
tracing::warn!(%id, %err, "failed to upload request data");
tracing::error!(%id, error = ?err, "failed to upload request data");
}
Ok(buffer.writer())