Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/client-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl Host {
.await
.map_err(|_| (StatusCode::NOT_FOUND, "module not found".to_string()))?;

tracing::info!(sql = body);
tracing::debug!(sql = body);
let mut header = vec![];
let sql_start = std::time::Instant::now();
let sql_span = tracing::trace_span!("execute_sql", total_duration = tracing::field::Empty,);
Expand Down
6 changes: 3 additions & 3 deletions crates/client-api/src/routes/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use derive_more::From;
use futures::TryStreamExt;
use http::StatusCode;
use http_body_util::BodyExt;
use log::{info, warn};
use log::{debug, info, warn};
use serde::Deserialize;
use spacetimedb::auth::identity::ConnectionAuthCtx;
use spacetimedb::database_logger::DatabaseLogger;
Expand Down Expand Up @@ -1254,7 +1254,7 @@ pub async fn pre_publish<S: NodeDelegate + ControlStateDelegate + Authorization>
PrettyPrintStyle::AnsiColor => AutoMigratePrettyPrintStyle::AnsiColor,
};

info!("planning migration for database {database_identity}");
debug!("planning migration for database {database_identity}");
let migrate_plan = ctx
.migrate_plan(
DatabaseDef {
Expand All @@ -1278,7 +1278,7 @@ pub async fn pre_publish<S: NodeDelegate + ControlStateDelegate + Authorization>
plan,
major_version_upgrade,
} => {
info!(
debug!(
"planned auto-migration of database {} from {} to {}",
database_identity, old_module_hash, new_module_hash
);
Expand Down
10 changes: 5 additions & 5 deletions crates/client-api/src/routes/subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@ where
Err(e) => {
let cause = match &e {
ClientConnectedError::Rejected(_) => {
log::info!("websocket: Rejecting connection for {client_log_string} due to rejection from client_connected reducer: {e}");
log::debug!("websocket: Rejecting connection for {client_log_string} due to rejection from client_connected reducer: {e}");
ClientRejectCause::ClientConnectedRejected
}
ClientConnectedError::OutOfEnergy => {
log::info!("websocket: Rejecting connection for {client_log_string} due to out of energy error from client_connected reducer: {e}");
log::debug!("websocket: Rejecting connection for {client_log_string} due to out of energy error from client_connected reducer: {e}");
ClientRejectCause::OutOfEnergy
}
ClientConnectedError::DBError(_) | ClientConnectedError::ReducerCall(_) => {
Expand Down Expand Up @@ -570,7 +570,7 @@ async fn ws_client_actor_inner(
let _ = unordered_tx.send(msg);
})
.await;
log::info!("Client connection ended: {client_id}");
log::trace!("Client connection ended: {client_id}");
}

/// The main `select!` loop of the websocket client actor.
Expand Down Expand Up @@ -734,7 +734,7 @@ async fn ws_main_loop<HotswapWatcher>(

// Exit if we haven't heard from the client for too long.
_ = &mut idle_timer => {
log::warn!("Client {} timed out", state.client_id);
log::debug!("Client {} timed out", state.client_id);
WORKER_METRICS
.ws_clients_idle_timed_out
.with_label_values(&state.database)
Expand Down Expand Up @@ -1001,7 +1001,7 @@ fn ws_recv_queue(
reason: Utf8Bytes::from_static("too many requests"),
});
let on_message_after_close = move |client_id| {
log::warn!("client {client_id} sent message after close or error");
log::debug!("client {client_id} sent message after close or error");
};

let max_incoming_queue_length = state.config.incoming_queue_length.get();
Expand Down
8 changes: 5 additions & 3 deletions crates/core/src/client/client_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use derive_more::From;
use futures::prelude::*;
use log::warn;
use prometheus::{Histogram, IntCounter, IntGauge};
use scopeguard::ScopeGuard;
use spacetimedb_auth::identity::{ConnectionAuthCtx, SpacetimeIdentityClaims};
use spacetimedb_client_api_messages::websocket::{common as ws_common, v1 as ws_v1, v2 as ws_v2};
use spacetimedb_durability::{DurableOffset, TxOffset};
Expand Down Expand Up @@ -884,17 +885,18 @@ impl ClientConnection {

let _gauge_guard = module_info.metrics.connected_clients.inc_scope();
module_info.metrics.ws_clients_spawned.inc();
scopeguard::defer! {
let abort_guard = scopeguard::guard((), |_| {
let database_identity = module_info.database_identity;
module_info.metrics.ws_clients_aborted.inc();
// This is always called for to make sure `ws_clients_aborted` is incremented, but we only want to log a warning here
// if we haven't already recorded a cause for this disconnection.
if actor_disconnect_recorder.record(ClientDisconnectCause::Unknown) {
log::warn!("websocket connection aborted for client identity `{client_identity}` and database identity `{database_identity}`");
}
};
});

fut.await
fut.await;
ScopeGuard::into_inner(abort_guard);
Comment thread
bfops marked this conversation as resolved.
})
.abort_handle();

Expand Down
7 changes: 0 additions & 7 deletions crates/core/src/host/wasm_common/module_host_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1819,13 +1819,6 @@ fn log_reducer_error(
.with_label_values(&replica_ctx.database_identity, module_hash, reducer)
.inc();

log::info!(
"reducer `{}` of database `{}` returned error: {}",
reducer,
replica_ctx.database_identity,
message
);

let record = Record {
ts: chrono::DateTime::from_timestamp_micros(timestamp.to_micros_since_unix_epoch()).unwrap(),
function: Some(reducer),
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/subscription/module_subscription_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2169,7 +2169,7 @@ fn send_to_client_v1(
message: impl Into<SerializableMessage>,
) {
if let Err(e) = client.send_message(tx_offset, OutboundMessage::V1(message.into())) {
tracing::warn!(%client.id, "failed to send update message to client: {e}")
tracing::debug!(%client.id, "failed to send update message to client: {e}")
}
}
fn send_to_client(
Expand All @@ -2180,7 +2180,7 @@ fn send_to_client(
) {
tracing::trace!(client = %client.id, tx_offset, "send_to_client");
if let Err(e) = client.send_message(tx_offset, message) {
tracing::warn!(%client.id, "failed to send update message to client: {e}")
tracing::debug!(%client.id, "failed to send update message to client: {e}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/datastore/src/locking_tx_datastore/state_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ pub trait StateView {
}

fn get_jwt_payload(&self, connection_id: ConnectionId) -> Result<Option<String>> {
log::info!("Getting JWT payload for connection id: {}", connection_id.to_hex());
log::trace!("Getting JWT payload for connection id: {}", connection_id.to_hex());
let mut buf: Vec<u8> = Vec::new();
self.iter_by_col_eq(
ST_CONNECTION_CREDENTIALS_ID,
Expand Down
2 changes: 1 addition & 1 deletion crates/pg/src/pg_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ where
let factory_ref = factory.clone();
tokio::spawn(async move {
process_socket(stream, None, factory_ref).await.inspect_err(|err|{
log::error!("PG: Error processing socket: {err:?}");
log::warn!("PG: Error processing socket: {err:?}");
})
});
}
Expand Down
Loading