mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 08:46:04 -04:00
Add health check endpoint (#8048)
This commit is contained in:
parent
4dd27e6d11
commit
7620912d84
7 changed files with 90 additions and 3 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue