Skip to content

Commit 7404887

Browse files
authored
proxy: Demote errors from cplane request routines to debug (#9886)
## 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.
1 parent 87e4dd2 commit 7404887

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

proxy/src/control_plane/client/mock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl MockControlPlane {
114114

115115
Ok((secret, allowed_ips))
116116
}
117-
.map_err(crate::error::log_error::<GetAuthInfoError>)
117+
.inspect_err(|e: &GetAuthInfoError| tracing::error!("{e}"))
118118
.instrument(info_span!("postgres", url = self.endpoint.as_str()))
119119
.await?;
120120
Ok(AuthInfo {

proxy/src/control_plane/client/neon.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ impl NeonControlPlaneClient {
134134
project_id: body.project_id,
135135
})
136136
}
137-
.map_err(crate::error::log_error)
138-
.instrument(info_span!("http", id = request_id))
137+
.inspect_err(|e| tracing::debug!(error = ?e))
138+
.instrument(info_span!("do_get_auth_info"))
139139
.await
140140
}
141141

@@ -193,8 +193,8 @@ impl NeonControlPlaneClient {
193193

194194
Ok(rules)
195195
}
196-
.map_err(crate::error::log_error)
197-
.instrument(info_span!("http", id = request_id))
196+
.inspect_err(|e| tracing::debug!(error = ?e))
197+
.instrument(info_span!("do_get_endpoint_jwks"))
198198
.await
199199
}
200200

@@ -252,9 +252,8 @@ impl NeonControlPlaneClient {
252252

253253
Ok(node)
254254
}
255-
.map_err(crate::error::log_error)
256-
// TODO: redo this span stuff
257-
.instrument(info_span!("http", id = request_id))
255+
.inspect_err(|e| tracing::debug!(error = ?e))
256+
.instrument(info_span!("do_wake_compute"))
258257
.await
259258
}
260259
}

proxy/src/error.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ pub(crate) fn io_error(e: impl Into<Box<dyn StdError + Send + Sync>>) -> io::Err
1010
io::Error::new(io::ErrorKind::Other, e)
1111
}
1212

13-
/// A small combinator for pluggable error logging.
14-
pub(crate) fn log_error<E: fmt::Display>(e: E) -> E {
15-
tracing::error!("{e}");
16-
e
17-
}
18-
1913
/// Marks errors that may be safely shown to a client.
2014
/// This trait can be seen as a specialized version of [`ToString`].
2115
///

0 commit comments

Comments
 (0)