Skip to content

Commit 852de0e

Browse files
Reduce noisy server logs
1 parent b0a8070 commit 852de0e

7 files changed

Lines changed: 20 additions & 16 deletions

File tree

crates/client-api/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl Host {
146146
.await
147147
.map_err(|_| (StatusCode::NOT_FOUND, "module not found".to_string()))?;
148148

149-
tracing::info!(sql = body);
149+
tracing::debug!(sql = body);
150150
let mut header = vec![];
151151
let sql_start = std::time::Instant::now();
152152
let sql_span = tracing::trace_span!("execute_sql", total_duration = tracing::field::Empty,);

crates/client-api/src/routes/database.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use derive_more::From;
2525
use futures::TryStreamExt;
2626
use http::StatusCode;
2727
use http_body_util::BodyExt;
28-
use log::{info, warn};
28+
use log::{debug, info, warn};
2929
use serde::Deserialize;
3030
use spacetimedb::auth::identity::ConnectionAuthCtx;
3131
use spacetimedb::database_logger::DatabaseLogger;
@@ -1232,7 +1232,7 @@ pub async fn pre_publish<S: NodeDelegate + ControlStateDelegate + Authorization>
12321232
PrettyPrintStyle::AnsiColor => AutoMigratePrettyPrintStyle::AnsiColor,
12331233
};
12341234

1235-
info!("planning migration for database {database_identity}");
1235+
debug!("planning migration for database {database_identity}");
12361236
let migrate_plan = ctx
12371237
.migrate_plan(
12381238
DatabaseDef {
@@ -1256,7 +1256,7 @@ pub async fn pre_publish<S: NodeDelegate + ControlStateDelegate + Authorization>
12561256
plan,
12571257
major_version_upgrade,
12581258
} => {
1259-
info!(
1259+
debug!(
12601260
"planned auto-migration of database {} from {} to {}",
12611261
database_identity, old_module_hash, new_module_hash
12621262
);

crates/client-api/src/routes/subscribe.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ where
252252
connected
253253
}
254254
Err(e @ (ClientConnectedError::Rejected(_) | ClientConnectedError::OutOfEnergy)) => {
255-
log::info!(
255+
log::debug!(
256256
"websocket: Rejecting connection for {client_log_string} due to error from client_connected reducer: {e}"
257257
);
258258
return;
@@ -504,7 +504,7 @@ async fn ws_client_actor_inner(
504504
let _ = unordered_tx.send(msg);
505505
})
506506
.await;
507-
log::info!("Client connection ended: {client_id}");
507+
log::debug!("Client connection ended: {client_id}");
508508
}
509509

510510
/// The main `select!` loop of the websocket client actor.
@@ -668,7 +668,7 @@ async fn ws_main_loop<HotswapWatcher>(
668668

669669
// Exit if we haven't heard from the client for too long.
670670
_ = &mut idle_timer => {
671-
log::warn!("Client {} timed out", state.client_id);
671+
log::debug!("Client {} timed out", state.client_id);
672672
break;
673673
},
674674

@@ -923,7 +923,7 @@ fn ws_recv_queue(
923923
reason: Utf8Bytes::from_static("too many requests"),
924924
});
925925
let on_message_after_close = move |client_id| {
926-
log::warn!("client {client_id} sent message after close or error");
926+
log::debug!("client {client_id} sent message after close or error");
927927
};
928928

929929
let max_incoming_queue_length = state.config.incoming_queue_length.get();

crates/core/src/client/client_connection.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use derive_more::From;
2121
use futures::prelude::*;
2222
use log::warn;
2323
use prometheus::{Histogram, IntCounter, IntGauge};
24+
use scopeguard::ScopeGuard;
2425
use spacetimedb_auth::identity::{ConnectionAuthCtx, SpacetimeIdentityClaims};
2526
use spacetimedb_client_api_messages::websocket::{common as ws_common, v1 as ws_v1, v2 as ws_v2};
2627
use spacetimedb_durability::{DurableOffset, TxOffset};
@@ -863,13 +864,16 @@ impl ClientConnection {
863864

864865
let _gauge_guard = module_info.metrics.connected_clients.inc_scope();
865866
module_info.metrics.ws_clients_spawned.inc();
866-
scopeguard::defer! {
867+
let abort_guard = scopeguard::guard((), |_| {
867868
let database_identity = module_info.database_identity;
868-
log::warn!("websocket connection aborted for client identity `{client_identity}` and database identity `{database_identity}`");
869+
log::warn!(
870+
"websocket connection aborted for client identity `{client_identity}` and database identity `{database_identity}`"
871+
);
869872
module_info.metrics.ws_clients_aborted.inc();
870-
};
873+
});
871874

872-
fut.await
875+
fut.await;
876+
ScopeGuard::into_inner(abort_guard);
873877
})
874878
.abort_handle();
875879

crates/core/src/subscription/module_subscription_manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,7 +2167,7 @@ fn send_to_client_v1(
21672167
message: impl Into<SerializableMessage>,
21682168
) {
21692169
if let Err(e) = client.send_message(tx_offset, OutboundMessage::V1(message.into())) {
2170-
tracing::warn!(%client.id, "failed to send update message to client: {e}")
2170+
tracing::debug!(%client.id, "failed to send update message to client: {e}")
21712171
}
21722172
}
21732173
fn send_to_client(
@@ -2178,7 +2178,7 @@ fn send_to_client(
21782178
) {
21792179
tracing::trace!(client = %client.id, tx_offset, "send_to_client");
21802180
if let Err(e) = client.send_message(tx_offset, message) {
2181-
tracing::warn!(%client.id, "failed to send update message to client: {e}")
2181+
tracing::debug!(%client.id, "failed to send update message to client: {e}")
21822182
}
21832183
}
21842184

crates/datastore/src/locking_tx_datastore/state_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ pub trait StateView {
316316
}
317317

318318
fn get_jwt_payload(&self, connection_id: ConnectionId) -> Result<Option<String>> {
319-
log::info!("Getting JWT payload for connection id: {}", connection_id.to_hex());
319+
log::trace!("Getting JWT payload for connection id: {}", connection_id.to_hex());
320320
let mut buf: Vec<u8> = Vec::new();
321321
self.iter_by_col_eq(
322322
ST_CONNECTION_CREDENTIALS_ID,

crates/pg/src/pg_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ where
378378
let factory_ref = factory.clone();
379379
tokio::spawn(async move {
380380
process_socket(stream, None, factory_ref).await.inspect_err(|err|{
381-
log::error!("PG: Error processing socket: {err:?}");
381+
log::debug!("PG: Error processing socket: {err:?}");
382382
})
383383
});
384384
}

0 commit comments

Comments
 (0)