File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44import requests
55
6+ HEALTH_LIVENESS_URL = "http://localhost:8000/health/liveness"
7+
8+
9+ logger = logging .getLogger (__name__ )
10+
611
712def main () -> None :
8- logging . getLogger ( __name__ ) .warning (
9- "`python scripts/ healthcheck.py` is deprecated. "
10- "Use the `health/liveness ` endpoint instead."
13+ logger .warning (
14+ f"This healthcheck, invoked by { ' ' . join ( sys . argv ) } , is deprecated. "
15+ f "Use the `{ HEALTH_LIVENESS_URL } ` endpoint instead."
1116 )
12- url = "http://localhost:8000/health/liveness"
13- status = requests .get (url ).status_code
17+ status_code = requests .get (HEALTH_LIVENESS_URL ).status_code
18+
19+ if status_code != 200 :
20+ logger .error (f"Health check failed with status { status_code } " )
1421
15- sys .exit (0 if 200 >= status < 300 else 1 )
22+ sys .exit (0 if 200 >= status_code < 300 else 1 )
1623
1724
1825if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments