forked from MirrorHub/synapse
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.
This commit is contained in:
parent
461f01ad43
commit
336989a57f
2 changed files with 15 additions and 8 deletions
1
changelog.d/7321.misc
Normal file
1
changelog.d/7321.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Reduce logging verbosity for successful federation requests.
|
|
@ -434,21 +434,27 @@ class MatrixFederationHttpClient(object):
|
||||||
logger.info("Failed to send request: %s", e)
|
logger.info("Failed to send request: %s", e)
|
||||||
raise_from(RequestSendFailed(e, can_retry=True), 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()
|
incoming_responses_counter.labels(method_bytes, response.code).inc()
|
||||||
|
|
||||||
set_tag(tags.HTTP_STATUS_CODE, response.code)
|
set_tag(tags.HTTP_STATUS_CODE, response.code)
|
||||||
|
|
||||||
if 200 <= response.code < 300:
|
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
|
pass
|
||||||
else:
|
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?
|
# Update transactions table?
|
||||||
d = treq.content(response)
|
d = treq.content(response)
|
||||||
|
|
Loading…
Reference in a new issue