Skip to content

Audit of warn! and error! - #5640

Open
JasonAtClockwork wants to merge 2 commits into
masterfrom
jlarabie/audit-logs
Open

Audit of warn! and error!#5640
JasonAtClockwork wants to merge 2 commits into
masterfrom
jlarabie/audit-logs

Conversation

@JasonAtClockwork

Copy link
Copy Markdown
Contributor

Description of Changes

Reviewed all warn! and error! lines for host side issues to get ready for alerting.

API and ABI breaking changes

No breaking changes.

Expected complexity level and risk

1 - Only changes to logging

Testing

  • Ran cargo test against impacted crates

Comment on lines +143 to +145
// TODO: May need to split this from module errors vs host errors
log::warn!("Internal error while invoking procedure {procedure}: {e:#}");
StatusCode::INTERNAL_SERVER_ERROR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Could we preserve whether this failure came from module code or the host? Module errors should remain low-level and eventually go to module logs, while internal host failures may need to stay at error! for alerting.

Comment on lines 855 to 861
if ws_version == WsVersion::V1
&& let MessageHandleError::Execution(err) = e
{
// TODO: Review log level after guest/client execution errors can be distinguished from internal failures.
log::error!("{err:#}");
// If the send task has exited, also exit this recv task.
if unordered_tx.send(err.into()).is_err() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This looks to combine module errors with possible host errors, that leads me to lean error! for now

Comment on lines 166 to 169
.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())

Copy link
Copy Markdown
Contributor Author

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.

Comment on lines +642 to 645
// 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()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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 error! my gut reaction is to change it to warn! and slowly clean up it's use?

Comment on lines +216 to 217
// 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:?}");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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 warn!

Comment on lines +682 to 685
// 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);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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.

Comment on lines +1403 to 1405
// TODO: Review log level after guest view errors can be distinguished from materialization failures.
log::error!("Error materializing view `{view_name}`: {err:?}");
ViewOutcome::Failed(format!("Error materializing view `{view_name}`: {err}"))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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.

@JasonAtClockwork
JasonAtClockwork marked this pull request as ready for review July 31, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant