File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010 path ('remote-service' , views .downstream_service ),
1111 path ('client-call' , views .async_service ),
1212 path ('mysql' , views .mysql ),
13+ path ('status/<int:code>' , views .status ),
1314]
Original file line number Diff line number Diff line change @@ -186,3 +186,13 @@ def mysql(request):
186186 logger .error ("Could not complete http request to RDS database:" + str (e ))
187187 finally :
188188 return get_xray_trace_id ()
189+
190+ def status (request , code ):
191+ ip = request .GET .get ('ip' , 'localhost' )
192+ ip = ip .replace ("/" , "" )
193+ try :
194+ requests .get (f"http://{ ip } :8001/status/{ code } " )
195+ except Exception :
196+ pass # Ignore exception
197+ logger .info (f"Service A requested status code { code } from Service B" )
198+ return get_xray_trace_id ()
Original file line number Diff line number Diff line change 55
66urlpatterns = [
77 path ('healthcheck' , views .healthcheck ),
8+ path ('status/<int:code>' , views .status ),
89]
Original file line number Diff line number Diff line change 44
55def healthcheck (request ):
66 return HttpResponse ("Remote service healthcheck" )
7+
8+ def status (request , code ):
9+ return HttpResponse (status = code )
You can’t perform that action at this time.
0 commit comments