diff options
author | Erik Johnston <erik@matrix.org> | 2020-08-07 14:21:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-07 14:21:24 +0100 |
commit | 7620912d84f6a8b24143f1340dd653f44b13bf30 (patch) | |
tree | 0429a0cfbe00c0d491643255b577520bf657c921 /synapse/http | |
parent | Reduce unnecessary whitespace in JSON. (#7372) (diff) | |
download | synapse-7620912d84f6a8b24143f1340dd653f44b13bf30.tar.xz |
Add health check endpoint (#8048)
Diffstat (limited to 'synapse/http')
-rw-r--r-- | synapse/http/site.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/http/site.py b/synapse/http/site.py index f506152fea..79a9229a26 100644 --- a/synapse/http/site.py +++ b/synapse/http/site.py @@ -286,7 +286,9 @@ class SynapseRequest(Request): # the connection dropped) code += "!" - self.site.access_logger.info( + log_level = logging.INFO if self._should_log_request() else logging.DEBUG + self.site.access_logger.log( + log_level, "%s - %s - {%s}" " Processed request: %.3fsec/%.3fsec (%.3fsec, %.3fsec) (%.3fsec/%.3fsec/%d)" ' %sB %s "%s %s %s" "%s" [%d dbevts]', @@ -314,6 +316,11 @@ class SynapseRequest(Request): except Exception as e: logger.warning("Failed to stop metrics: %r", e) + def _should_log_request(self) -> bool: + """Whether we should log at INFO that we processed the request. + """ + return self.path != b"/health" + class XForwardedForRequest(SynapseRequest): def __init__(self, *args, **kw): |