element-hq / element-hq/synapse

Make healthcheck check a little bit more

Open
#11,473 0 comments 1 reaction 0 assignees View on GitHub
T-Enhancement
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#11473](https://github.com/matrix-org/synapse/issues/11473).

---

Currently `/health` looks like this;

```py
def render_GET(self, request: Request) -> bytes:
request.setHeader(b"Content-Type", b"text/plain")
return b"OK"
```

Which is functionally equivalent to calling `/versions` on the endpoint.

I think that this should do a little more than just blindly respond with 'everything is fine', giving me a similar feeling to the following meme;

![image](https://user-images.githubusercontent.com/22740616/144230602-53f1159f-bb75-422e-ab00-3e46b7093d6f.png)

---

Jokes aside, i think that this endpoint should perform or otherwise "check up" on some basic functionality, or otherwise return "not OK" (with 5XX) when some precondition isn't present (which could be defined from other resources).

Maybe this could be linked to an "error counter", which would count the last amount of exceptions in the last minute, and this health resource should then return "not OK" if it passes a threshold.

Other than that, this is open for further ideas.

Contributor guide

Open the contributing guide

Research direction

Start at the /health endpoint's render_GET implementation shown in the issue and compare its behavior with /versions. Define the basic functionality or preconditions and error threshold before changing the response; done means /health returns not OK with a 5XX when a stated condition fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.