Skip to content

Commit

Permalink
proxy: Demote errors from cplane request routines to debug (#9886)
Browse files Browse the repository at this point in the history
## Problem

Any errors from these async blocks are unconditionally logged at error
level
even though we already handle such errors based on context.

## Summary of changes

* Log raw errors from creating and executing cplane requests at debug
level.
* Inline macro calls to retain the correct callsite.
  • Loading branch information
cloneable authored Nov 25, 2024
1 parent 87e4dd2 commit 7404887
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion proxy/src/control_plane/client/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl MockControlPlane {

Ok((secret, allowed_ips))
}
.map_err(crate::error::log_error::<GetAuthInfoError>)
.inspect_err(|e: &GetAuthInfoError| tracing::error!("{e}"))
.instrument(info_span!("postgres", url = self.endpoint.as_str()))
.await?;
Ok(AuthInfo {
Expand Down
13 changes: 6 additions & 7 deletions proxy/src/control_plane/client/neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ impl NeonControlPlaneClient {
project_id: body.project_id,
})
}
.map_err(crate::error::log_error)
.instrument(info_span!("http", id = request_id))
.inspect_err(|e| tracing::debug!(error = ?e))
.instrument(info_span!("do_get_auth_info"))
.await
}

Expand Down Expand Up @@ -193,8 +193,8 @@ impl NeonControlPlaneClient {

Ok(rules)
}
.map_err(crate::error::log_error)
.instrument(info_span!("http", id = request_id))
.inspect_err(|e| tracing::debug!(error = ?e))
.instrument(info_span!("do_get_endpoint_jwks"))
.await
}

Expand Down Expand Up @@ -252,9 +252,8 @@ impl NeonControlPlaneClient {

Ok(node)
}
.map_err(crate::error::log_error)
// TODO: redo this span stuff
.instrument(info_span!("http", id = request_id))
.inspect_err(|e| tracing::debug!(error = ?e))
.instrument(info_span!("do_wake_compute"))
.await
}
}
Expand Down
6 changes: 0 additions & 6 deletions proxy/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ pub(crate) fn io_error(e: impl Into<Box<dyn StdError + Send + Sync>>) -> io::Err
io::Error::new(io::ErrorKind::Other, e)
}

/// A small combinator for pluggable error logging.
pub(crate) fn log_error<E: fmt::Display>(e: E) -> E {
tracing::error!("{e}");
e
}

/// Marks errors that may be safely shown to a client.
/// This trait can be seen as a specialized version of [`ToString`].
///
Expand Down

1 comment on commit 7404887

@github-actions
Copy link

@github-actions github-actions bot commented on 7404887 Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7076 tests run: 6743 passed, 0 failed, 333 skipped (full report)


Flaky tests (2)

Postgres 17

Postgres 15

Code coverage* (full report)

  • functions: 30.8% (7971 of 25847 functions)
  • lines: 48.6% (63293 of 130153 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
7404887 at 2024-11-25T23:50:30.394Z :recycle:

Please sign in to comment.