-
Notifications
You must be signed in to change notification settings - Fork 1k
Audit of warn! and error! #5640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
205216b
724a927
faad664
30c3990
22620e2
550065b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -164,6 +164,7 @@ impl Host { | |
| ) | ||
| .await | ||
| .map_err(|e| { | ||
| // TODO: Review log level after user SQL errors can be distinguished from internal database failures. | ||
| log::warn!("{e}"); | ||
| (StatusCode::BAD_REQUEST, e.to_string()) | ||
| })?; | ||
|
|
@@ -638,6 +639,7 @@ impl<T: Authorization> Authorization for Arc<T> { | |
| } | ||
| } | ||
|
|
||
| // TODO: Review each caller and split this helper by the appropriate log severity. | ||
| pub fn log_and_500(e: impl std::fmt::Display) -> ErrorResponse { | ||
| log::error!("internal error: {e:#}"); | ||
| (StatusCode::INTERNAL_SERVER_ERROR, format!("{e:#}")).into() | ||
|
Comment on lines
+642
to
645
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to be very broadly used which makes it hard to know if it should be reduced from
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please change to |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -213,6 +213,7 @@ impl async_cache::Fetcher<Arc<JwksValidator>> for KeyFetcher { | |
| // TODO: We should probably add debouncing to avoid spamming the logs. | ||
| // Alternatively we could add a backoff before retrying. | ||
| if let Err(e) = &key_or_error { | ||
| // TODO: Review log level after configured issuers can be distinguished from arbitrary token issuers. | ||
| log::warn!("Error fetching public key for issuer {raw_issuer}: {e:?}"); | ||
|
Comment on lines
+216
to
217
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one I'm not 100% sure if we need to split up or count everything as
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no clue. At this stage I'm unconcerned. |
||
| } | ||
| let keys = key_or_error?; | ||
|
|
@@ -265,6 +266,7 @@ impl TokenValidator for OidcTokenValidator { | |
| // TODO: We should probably add debouncing to avoid spamming the logs. | ||
| // Alternatively we could add a backoff before retrying. | ||
| if let Err(e) = &key_or_error { | ||
| // TODO: Review log level after configured issuers can be distinguished from arbitrary token issuers. | ||
| log::warn!("Error fetching public key for issuer {raw_issuer}: {e:?}"); | ||
| } | ||
| let keys = key_or_error?; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -682,6 +682,7 @@ impl InstanceCommon { | |
|
|
||
| match res { | ||
| Err(e) => { | ||
| // TODO: Review log level after migration/user errors can be distinguished from internal database failures. | ||
| log::warn!("Database update failed: {} @ {}", e, stdb.database_identity()); | ||
| system_logger.warn(&format!("Database update failed: {e}")); | ||
| let (_, tx_metrics, reducer) = stdb.rollback_mut_tx(tx); | ||
|
Comment on lines
+685
to
688
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another spot where it looks like real failures can be mixed in with user issues.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make a follow-up?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a follow-up: #5691 |
||
|
|
@@ -1392,7 +1393,8 @@ impl InstanceCommon { | |
| match outcome { | ||
| Ok(outcome) => outcome, | ||
| Err(err) => { | ||
| log::error!("Error materializing view `{view_name}`: {err:?}"); | ||
| // TODO: Review log level after guest view errors can be distinguished from materialization failures. | ||
| log::warn!("Error materializing view `{view_name}`: {err:?}"); | ||
| ViewOutcome::Failed(format!("Error materializing view `{view_name}`: {err}")) | ||
|
Comment on lines
+1396
to
1398
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one looked similar as above but I'm not certain if it's true that it can be mixed here.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another follow-up ticket? And, can @joshua-spacetime weigh in as to whether user errors can happen here, which I assume would be if a view function panics.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes if a view function panics. Primary key violations too.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, then we should drop this to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dropped to |
||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as other areas we might want to split this up so we can use
error!if there is a database failure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create a follow-up ticket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up created: #5690
I did go down the rabbit-hole of all the possible issues and decided to make the follow-up simple instead of declaring all possible areas of concern.