From 4867104be9ae6674139164b47c19093631ef2c9e Mon Sep 17 00:00:00 2001 From: meowjesty Date: Tue, 15 Oct 2024 19:00:29 -0300 Subject: [PATCH] docs and reduce logs --- mirrord/agent/src/dns.rs | 7 ++----- mirrord/layer/src/socket/ops.rs | 2 +- mirrord/protocol/src/error.rs | 7 +++++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mirrord/agent/src/dns.rs b/mirrord/agent/src/dns.rs index 39636680369..8706c45173a 100644 --- a/mirrord/agent/src/dns.rs +++ b/mirrord/agent/src/dns.rs @@ -86,8 +86,7 @@ impl DnsWorker { let resolv_conf_path = etc_path.join("resolv.conf"); let hosts_path = etc_path.join("hosts"); - // TODO(alex) [high] 1: Return an io error here so we can inspect it in mirrord. - let resolv_conf = fs::read("/meow/meow").await?; + let resolv_conf = fs::read(resolv_conf_path).await?; let hosts_conf = fs::read(hosts_path).await?; let (config, mut options) = parse_resolv_conf(resolv_conf)?; @@ -112,7 +111,7 @@ impl DnsWorker { } /// Handles the given [`DnsCommand`] in a separate [`tokio::task`]. - #[tracing::instrument(level = Level::DEBUG, skip(self))] + #[tracing::instrument(level = Level::TRACE, skip(self))] fn handle_message(&self, message: DnsCommand) { let etc_path = self.etc_path.clone(); let timeout = self.timeout; @@ -193,8 +192,6 @@ impl DnsApi { return future::pending().await; }; - tracing::info!(?response); - let response = response?.map_err(|fail| match fail { ResponseError::RemoteIO(remote_ioerror) => ResponseError::DnsLookup(DnsLookupError { kind: remote_ioerror.kind.into(), diff --git a/mirrord/layer/src/socket/ops.rs b/mirrord/layer/src/socket/ops.rs index 180c76aa605..ffbb36a9b52 100644 --- a/mirrord/layer/src/socket/ops.rs +++ b/mirrord/layer/src/socket/ops.rs @@ -872,7 +872,7 @@ pub(super) fn dup(fd: c_int, dup_fd: i32) -> Result<(), /// # Note /// /// This function updates the mapping in [`REMOTE_DNS_REVERSE_MAPPING`]. -#[mirrord_layer_macro::instrument(level = Level::DEBUG, ret, err)] +#[mirrord_layer_macro::instrument(level = Level::TRACE, ret, err)] pub(super) fn remote_getaddrinfo(node: String) -> HookResult> { let addr_info_list = common::make_proxy_request_with_response(GetAddrInfoRequest { node })?.0?; diff --git a/mirrord/protocol/src/error.rs b/mirrord/protocol/src/error.rs index 0bc06fa4339..2356d7b2a12 100644 --- a/mirrord/protocol/src/error.rs +++ b/mirrord/protocol/src/error.rs @@ -151,6 +151,9 @@ pub struct RemoteIOError { /// Our internal version of Rust's `std::io::Error` that can be passed between mirrord-layer and /// mirrord-agent. +/// +/// [`ResolveErrorKindInternal`] has a nice [`core::fmt::Display`] implementation that +/// should be user friendly, and can be appended to the generic error message here. #[derive(Encode, Decode, Debug, PartialEq, Clone, Eq, Error)] #[error("Failed performing `getaddrinfo` with: {kind}!")] pub struct DnsLookupError { @@ -158,7 +161,7 @@ pub struct DnsLookupError { } impl From for ResponseError { - #[tracing::instrument(level = Level::DEBUG, ret)] + #[tracing::instrument(level = Level::TRACE, ret)] fn from(io_error: io::Error) -> Self { Self::RemoteIO(RemoteIOError { raw_os_error: io_error.raw_os_error(), @@ -168,7 +171,7 @@ impl From for ResponseError { } impl From for ResponseError { - #[tracing::instrument(level = Level::DEBUG, ret)] + #[tracing::instrument(level = Level::TRACE, ret)] fn from(fail: ResolveError) -> Self { match fail.kind().to_owned() { ResolveErrorKind::Io(io_fail) => io_fail.into(),