Skip to content

Commit

Permalink
Use GET HTTP verb for Executor monitoring API
Browse files Browse the repository at this point in the history
Looks like there are no concerns wrt GET response caching by default
as Prometheus uses GET verb.

curl:

```
curl http://localhost:7000/monitoring/startup
{"status": "ok"}%
curl http://localhost:7000/monitoring/health
{"status": "ok", "message": "All Function Executors pass health checks", "checker": "GenericHealthChecker"}
```
  • Loading branch information
eabatalov committed Feb 7, 2025
1 parent 41bde38 commit 4d00860
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions indexify/src/indexify/executor/monitoring/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def __init__(
self._app: web.Application = web.Application()
self._app.add_routes(
[
web.post("/monitoring/startup", startup_probe_handler.handle),
web.post("/monitoring/health", health_probe_handler.handle),
web.get("/monitoring/startup", startup_probe_handler.handle),
web.get("/monitoring/health", health_probe_handler.handle),
]
)
self._app_runner: web.AppRunner = web.AppRunner(self._app)
Expand Down
4 changes: 2 additions & 2 deletions indexify/tests/cli/test_health_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_success(self):
print(f"Started Executor A with PID: {executor_a.pid}")
wait_executor_startup(7001)

response = httpx.post("http://localhost:7001/monitoring/health")
response = httpx.get("http://localhost:7001/monitoring/health")
self.assertEqual(response.status_code, 200)
self.assertEqual(
response.json(),
Expand All @@ -67,7 +67,7 @@ def test_failure_after_function_executor_process_crash(self):
self.assertEqual(len(output), 0)

# Verify that the default Executor health check fails after the Function Executor crashed.
response = httpx.post("http://localhost:7000/monitoring/health")
response = httpx.get("http://localhost:7000/monitoring/health")
self.assertEqual(response.status_code, 503)
self.assertEqual(
response.json(),
Expand Down
2 changes: 1 addition & 1 deletion indexify/tests/cli/test_startup_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_success(self):
executor_a: subprocess.Popen
print(f"Started Executor A with PID: {executor_a.pid}")
wait_executor_startup(7001)
response = httpx.post(f"http://localhost:7001/monitoring/startup")
response = httpx.get(f"http://localhost:7001/monitoring/startup")
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), {"status": "ok"})

Expand Down
2 changes: 1 addition & 1 deletion indexify/tests/cli/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def wait_executor_startup(port: int):
attempts_left: int = 5
while attempts_left > 0:
try:
response = httpx.post(f"http://localhost:{port}/monitoring/startup")
response = httpx.get(f"http://localhost:{port}/monitoring/startup")
if response.status_code == 200:
print(f"Executor startup check successful at port {port}")
return
Expand Down

0 comments on commit 4d00860

Please sign in to comment.