improve incoming http request and other logging

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-03-26 14:36:27 -07:00 committed by June
parent 0df1f84cc8
commit cb12f285e9
2 changed files with 12 additions and 9 deletions

View file

@ -18,7 +18,7 @@ use ruma::{
CanonicalJsonValue, OwnedDeviceId, OwnedServerName, UserId, CanonicalJsonValue, OwnedDeviceId, OwnedServerName, UserId,
}; };
use serde::Deserialize; use serde::Deserialize;
use tracing::{debug, error, warn}; use tracing::{debug, error, trace, warn};
use super::{Ruma, RumaResponse}; use super::{Ruma, RumaResponse};
use crate::{services, Error, Result}; use crate::{services, Error, Result};
@ -334,9 +334,14 @@ where
} }
let http_request = http_request.body(&*body).unwrap(); let http_request = http_request.body(&*body).unwrap();
debug!(
"{:?} {:?} {:?}",
http_request.method(),
http_request.uri(),
http_request.headers()
);
debug!("{:?}", http_request); trace!("{:?} {:?} {:?}", http_request.method(), http_request.uri(), json_body);
let body = T::try_from_http_request(http_request, &path_params).map_err(|e| { let body = T::try_from_http_request(http_request, &path_params).map_err(|e| {
warn!("try_from_http_request failed: {e:?}\nPath parameters: {path_params:?}",); warn!("try_from_http_request failed: {e:?}\nPath parameters: {path_params:?}",);
debug!("JSON body: {:?}", json_body); debug!("JSON body: {:?}", json_body);

View file

@ -1307,7 +1307,7 @@ impl Service {
if server_key_ids.is_empty() { if server_key_ids.is_empty() {
// Nothing to do, can exit early // Nothing to do, can exit early
debug!("server_key_ids is empty, not fetching any keys"); trace!("server_key_ids is empty, not fetching any keys");
return Ok(()); return Ok(());
} }
@ -1566,7 +1566,7 @@ impl Service {
}; };
if servers.is_empty() { if servers.is_empty() {
info!("We had all keys cached locally, not fetching any keys from remote servers"); trace!("We had all keys cached locally, not fetching any keys from remote servers");
return Ok(()); return Ok(());
} }
@ -1605,7 +1605,7 @@ impl Service {
.await?; .await?;
} }
info!("Search for signing keys done"); debug!("Search for signing keys done");
/*if servers.is_empty() { /*if servers.is_empty() {
warn!("Failed to find homeserver signing keys for the remaining servers: {servers:?}"); warn!("Failed to find homeserver signing keys for the remaining servers: {servers:?}");
@ -1722,8 +1722,6 @@ impl Service {
} }
} }
debug!("Loading signing keys for {origin} from our database if available");
let mut result: BTreeMap<_, _> = services() let mut result: BTreeMap<_, _> = services()
.globals .globals
.signing_keys_for(origin)? .signing_keys_for(origin)?
@ -1732,7 +1730,7 @@ impl Service {
.collect(); .collect();
if contains_all_ids(&result) { if contains_all_ids(&result) {
debug!("We have all homeserver signing keys locally for {origin}, not fetching any remotely"); trace!("We have all homeserver signing keys locally for {origin}, not fetching any remotely");
return Ok(result); return Ok(result);
} }