More cleanup related to error logging#9942
Open
sruggier wants to merge 7 commits intooxidecomputer:mainfrom
Open
More cleanup related to error logging#9942sruggier wants to merge 7 commits intooxidecomputer:mainfrom
sruggier wants to merge 7 commits intooxidecomputer:mainfrom
Conversation
This change updates all handlers of omicron_sled_agent::Error to use the InlineErrorChain adapter, then removes all duplicate source error messages from its Display implementation. There are some variants that include the source chain in Display output, but leave the source unset. That arrangement doesn't result in any duplicate log output, so it's more graceful to defer updating those variants into the commit that performs the same transition on the corresponding source error type.
It looks like all code paths that handle ConfigError are already attaching it to error types that will log the full chain of sources, so there's nothing else to do for this type.
Previously, only the next level down would be logged, in case of NodeRequestError::Fsm and NodeRequestError::Recv. This commit links bootstore::NodeRequestError as a source, instead of formatting it as a string, which drops the rest of the chain.
This commit updates handle_start_sled_agent_request to log the full error chain in case a SledAgentServerStartError is returned. Previously, one level of cause would be logged for the FailedLearnerInit variant, and CommitToLedger errors were logged without any information about the source.
The main consumer of this error type seems to be omicron_sled_agent::sled_agent::Error, so this commit has the effect of fixing duplication in error logging that was introduced by a previous commit within the same PR.
This change modifies all of the code paths that handle omicron_sled_agent::instance::Error so they use the InlineErrorChain adapter before logging error messages, and then updates the enum definition to avoid duplicate error emission from its `Display` implementation.
Similar to previous commits, this updates all handlers of omicron_sled_agent::services::Error such that they recurse into sources instead of relying on the duplication of source error messages in its `Display` implementation. It then also removes all duplicated error strings from its `Display` implementation, defining sources instead, where applicable.
95e1b2a to
c0bb317
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a bit of a grab bag of error logging related fixes, carefully ordered (as described in #9804) to err on the side of potentially logging source error messages multiple times, rather than not at all.
This is related to #9804, but not yet close to fixing every inconsistency in how errors are logged.