summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Kaye <1917473+michaelkaye@users.noreply.github.com>2020-04-22 11:18:18 +0100
committerGitHub <noreply@github.com>2020-04-22 11:18:18 +0100
commit336989a57f100fccbc09bf25a9a54d800befec5e (patch)
tree0eef65273cd0f322c052bfa17a294aa2cb337018
parentMerge branch 'release-v1.12.4' into develop (diff)
downloadsynapse-336989a57f100fccbc09bf25a9a54d800befec5e.tar.xz
Reduce federation logging on success (#7321)
Splitting based on the response code means we can avoid double logging here and identical information from line 164 while still logging at info if we don't get a good response and need to retry.
Diffstat (limited to '')
-rw-r--r--changelog.d/7321.misc1
-rw-r--r--synapse/http/matrixfederationclient.py22
2 files changed, 15 insertions, 8 deletions
diff --git a/changelog.d/7321.misc b/changelog.d/7321.misc
new file mode 100644
index 0000000000..a4b3e67af9
--- /dev/null
+++ b/changelog.d/7321.misc
@@ -0,0 +1 @@
+Reduce logging verbosity for successful federation requests.
diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py
index 6f1bb04d8b..6b0a532c05 100644
--- a/synapse/http/matrixfederationclient.py
+++ b/synapse/http/matrixfederationclient.py
@@ -434,21 +434,27 @@ class MatrixFederationHttpClient(object):
                         logger.info("Failed to send request: %s", e)
                         raise_from(RequestSendFailed(e, can_retry=True), e)
 
-                    logger.info(
-                        "{%s} [%s] Got response headers: %d %s",
-                        request.txn_id,
-                        request.destination,
-                        response.code,
-                        response.phrase.decode("ascii", errors="replace"),
-                    )
-
                     incoming_responses_counter.labels(method_bytes, response.code).inc()
 
                     set_tag(tags.HTTP_STATUS_CODE, response.code)
 
                     if 200 <= response.code < 300:
+                        logger.debug(
+                            "{%s} [%s] Got response headers: %d %s",
+                            request.txn_id,
+                            request.destination,
+                            response.code,
+                            response.phrase.decode("ascii", errors="replace"),
+                        )
                         pass
                     else:
+                        logger.info(
+                            "{%s} [%s] Got response headers: %d %s",
+                            request.txn_id,
+                            request.destination,
+                            response.code,
+                            response.phrase.decode("ascii", errors="replace"),
+                        )
                         # :'(
                         # Update transactions table?
                         d = treq.content(response)