Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to not log ping requests #3544

Closed
johanfleury opened this issue Jan 7, 2021 · 2 comments · Fixed by #3550
Closed

Allow to not log ping requests #3544

johanfleury opened this issue Jan 7, 2021 · 2 comments · Fixed by #3550

Comments

@johanfleury
Copy link
Contributor

Describe the problem to be solved

It can happen that a process crashes in a way where it gets stuck but doesn’t exits. For this reason Docker (and Kubernetes) has a feature called health check that allows to check that the process is still working as expected (and restart the container if not).

This can be done by a script doing some hard work, but most of the time it’s just about curl’ing a simple API endpoint that replies with HTTP status code 200.

PeerTube doesn’t have such an health check endpoint.

Describe the solution you would like:

This endpoint should do the following:

  • Reply with status code 200
  • (Optional) Reply with a JSON body describing the current status (it’s often just {"status": "ok"})
  • Avoid logging request either at the discretion of the administrator (with a specific setting in the configuration files) or at the discretion of the client (with a query parameter e.g. <endpoint>?silent=true)

The path of the endpoint could be something like /health/live (in line with how Kubernetes names this feature, and would allow for an eventual future implementation of a “readiness” use this feature and allow a /health/ready

Describe alternatives you have considered

I am currently using / to check if PeerTube is still alive, but the main issue is that it logs every single request:

$ k logs -n peertube peertube-0 peertube | grep -m 1 kube-probe
[***:443] 2021-01-07 14:38:57.755 info: 10.2.0.1 - - [07/Jan/2021:14:38:57 +0000] "GET / HTTP/1.1" 200 3997 "-" "kube-probe/1.20"
$ k logs -n peertube peertube-0 peertube | grep -c kube-probe
1048
@kontrollanten
Copy link
Contributor

Hi! Have you seen that /api/v1/ping exists? But I think it still logs the requests.

@johanfleury
Copy link
Contributor Author

Hey, no I didn’t saw it.

Regarding logging, I’ve looked at morgan’s documentation and I think I can come up with a PR.

@Chocobozzz Chocobozzz changed the title Add an endpoint for health checks (liveness) Allow to not log ping requests Jan 8, 2021
@rigelk rigelk linked a pull request Jan 9, 2021 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants