chore(sdk): Log the request body for sliding sync requests

This commit is contained in:
Damir Jelić
2023-01-16 14:16:16 +01:00
parent 87f5b251f5
commit 928871d16e

View File

@@ -253,7 +253,7 @@ impl HttpClient {
#[instrument(
skip(self, access_token, config, request, user_id),
fields(config, path, user_id, request_id, status)
fields(config, path, user_id, request_body, request_id, status)
)]
pub async fn send<R>(
&self,
@@ -302,6 +302,15 @@ impl HttpClient {
span.record("path", request.uri().path());
// Since sliding sync is experimental, and the proxy might not do what we expect
// it to do given a specific request body, it's useful to log the
// request body here. This doesn't contain any personal information.
// TODO: Remove this once sliding sync isn't experimental anymore.
#[cfg(feature = "experimental-sliding-sync")]
if type_name::<R>() == "ruma_client_api::sync::sync_events::v4::Request" {
span.record("request_body", debug(request.body()));
}
debug!("Sending request");
match self.send_request::<R>(request, config).await {
Ok((status_code, response)) => {