Merge lp:~jelmer/loggerhead/health into lp:loggerhead

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Colin Watson
Approved revision: 520
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: lp:~jelmer/loggerhead/health
Merge into: lp:loggerhead
Diff against target: 34 lines (+8/-1)
2 files modified
loggerhead/apps/__init__.py (+5/-0)
loggerhead/apps/branch.py (+3/-1)
To merge this branch: bzr merge lp:~jelmer/loggerhead/health
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+412819@code.launchpad.net

Commit message

Add a /health target.

Description of the change

Add a /health target.

This is convenient for health checking in e.g. kubernetes.

At the moment it just returns okay, but it could return something else in the future.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve
Revision history for this message
Otto Co-Pilot (otto-copilot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loggerhead/apps/__init__.py'
2--- loggerhead/apps/__init__.py 2018-10-20 11:09:30 +0000
3+++ loggerhead/apps/__init__.py 2021-12-06 23:41:19 +0000
4@@ -18,3 +18,8 @@
5
6 robots_app = convert_file_errors(fileapp.FileApp(
7 os.path.join(static, 'robots.txt')))
8+
9+
10+def health_app(environ, start_response):
11+ start_response('200 OK', [])
12+ yield b'ok'
13
14=== modified file 'loggerhead/apps/branch.py'
15--- loggerhead/apps/branch.py 2020-06-04 19:43:36 +0000
16+++ loggerhead/apps/branch.py 2021-12-06 23:41:19 +0000
17@@ -29,7 +29,7 @@
18 from paste import request
19 from paste import httpexceptions
20
21-from ..apps import static_app
22+from ..apps import static_app, health_app
23 from ..controllers.annotate_ui import AnnotateUI
24 from ..controllers.view_ui import ViewUI
25 from ..controllers.atom_ui import AtomUI
26@@ -190,6 +190,8 @@
27 if not path:
28 raise httpexceptions.HTTPMovedPermanently(
29 self.absolute_url('/changes'))
30+ if path == 'health':
31+ return health_app
32 if path == 'static':
33 return static_app
34 elif path == '+json':

Subscribers

People subscribed via source and target branches