Skip to content

Commit 5b2c074

Browse files
authored
Clean up some instances of mishandled error logging (#9923)
This cleans up handling of `DdmError` and `ResolveError`. It also updates any downstream code that was previously relying on the redundancy in `DdmError`'s `Display` implementation, such that it instead relies on the implementation of `slog::Value` from the `slog-error-chain` crate. Related to #9804 and #9803.
1 parent 074bef1 commit 5b2c074

File tree

7 files changed

+12
-9
lines changed

7 files changed

+12
-9
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/ddm-admin-client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ sled-hardware-types.workspace = true
2222
omicron-workspace-hack.workspace = true
2323
ddm-admin-client.workspace = true
2424
uuid.workspace = true
25+
slog-error-chain.workspace = true

clients/ddm-admin-client/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use sled_hardware_types::underlay::BOOTSTRAP_MASK;
1818
use sled_hardware_types::underlay::BOOTSTRAP_PREFIX;
1919
use sled_hardware_types::underlay::BootstrapInterface;
2020
use slog::Logger;
21+
use slog_error_chain::SlogInlineError;
2122
use std::net::Ipv6Addr;
2223
use std::net::SocketAddr;
2324
use std::net::SocketAddrV6;
@@ -28,12 +29,12 @@ use crate::types::EnableStatsRequest;
2829
// TODO-cleanup Is it okay to hardcode this port number here?
2930
const DDMD_PORT: u16 = 8000;
3031

31-
#[derive(Debug, Error)]
32+
#[derive(Debug, Error, SlogInlineError)]
3233
pub enum DdmError {
33-
#[error("Failed to construct an HTTP client: {0}")]
34+
#[error("Failed to construct an HTTP client:")]
3435
HttpClient(#[from] reqwest012::Error),
3536

36-
#[error("Failed making HTTP request to ddmd: {0}")]
37+
#[error("Failed making HTTP request to ddmd")]
3738
DdmdApi(#[from] Error<types::Error>),
3839
}
3940

sled-agent/src/bootstrap/bootstore_setup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub async fn poll_ddmd_for_bootstore_and_tq_peer_update(
144144
Err(err) => {
145145
warn!(
146146
log, "Failed to get prefixes from ddmd";
147-
"err" => #%err,
147+
&err,
148148
);
149149
break;
150150
}

sled-agent/src/bootstrap/early_networking.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub enum EarlyNetworkSetupError {
6262
#[error("Bad configuration for setting up rack: {0}")]
6363
BadConfig(String),
6464

65-
#[error("Error contacting ddmd: {0}")]
65+
#[error("Error contacting ddmd")]
6666
DdmError(#[from] DdmError),
6767

6868
#[error("Error during request to MGS: {0}")]
@@ -71,7 +71,7 @@ pub enum EarlyNetworkSetupError {
7171
#[error("Error during request to Dendrite: {0}")]
7272
Dendrite(String),
7373

74-
#[error("Error during DNS lookup: {0}")]
74+
#[error("Error during DNS lookup")]
7575
DnsResolver(#[from] ResolveError),
7676

7777
#[error("BGP configuration error: {0}")]

sled-agent/src/services.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pub enum Error {
194194
#[error(transparent)]
195195
ZoneInstall(#[from] illumos_utils::running_zone::InstallZoneError),
196196

197-
#[error("Error contacting ddmd: {0}")]
197+
#[error("Error contacting ddmd")]
198198
DdmError(#[from] DdmError),
199199

200200
#[error("Failed to access underlay device: {0}")]

wicketd/src/bootstrap_addrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ async fn possible_sled_agent_addrs(
145145
Err(err) => {
146146
warn!(
147147
log, "Failed to get prefixes from ddm";
148-
"err" => #%err,
148+
&err,
149149
);
150150
tokio::time::sleep(RETRY).await;
151151
}
@@ -164,7 +164,7 @@ async fn make_ddm_admin_client(log: &Logger) -> DdmAdminClient {
164164
Err(err) => {
165165
warn!(
166166
log, "Failed to construct DdmAdminClient";
167-
"err" => #%err,
167+
&err,
168168
);
169169
tokio::time::sleep(DDM_CONSTRUCT_RETRY).await;
170170
}

0 commit comments

Comments
 (0)