Skip to content

Commit

Permalink
docs and reduce logs
Browse files Browse the repository at this point in the history
  • Loading branch information
meowjesty committed Oct 15, 2024
1 parent 0ff4221 commit 4867104
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
7 changes: 2 additions & 5 deletions mirrord/agent/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand All @@ -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;
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion mirrord/layer/src/socket/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ pub(super) fn dup<const SWITCH_MAP: bool>(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<Vec<(String, IpAddr)>> {
let addr_info_list = common::make_proxy_request_with_response(GetAddrInfoRequest { node })?.0?;

Expand Down
7 changes: 5 additions & 2 deletions mirrord/protocol/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,17 @@ 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 {
pub kind: ResolveErrorKindInternal,
}

impl From<io::Error> 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(),
Expand All @@ -168,7 +171,7 @@ impl From<io::Error> for ResponseError {
}

impl From<ResolveError> 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(),
Expand Down

0 comments on commit 4867104

Please sign in to comment.