@@ -19,16 +19,20 @@ async def post_predict(
19
19
logger .info (f"Received request: { data } " )
20
20
21
21
# Sample request
22
- tracer_attributes = {"http.client_ip" : x_forwarded_for }
23
- with tracer .start_as_current_span (
24
- "dependency_span" , attributes = tracer_attributes , kind = SpanKind .CLIENT
25
- ) as span :
26
- try :
27
- async with httpx .AsyncClient () as client :
28
- response = await client .get ("https://www.bing.com" )
29
- logger .info (f"Received response status code: { response .status_code } " )
30
- except Exception as ex :
31
- span .set_attribute ("status" , "exception" )
32
- span .record_exception (ex )
22
+ async with httpx .AsyncClient () as client :
23
+ response = await client .get ("https://www.bing.com" )
24
+ logger .info (f"Received response status code: { response .status_code } " )
25
+
26
+ # tracer_attributes = {"http.client_ip": x_forwarded_for}
27
+ # with tracer.start_as_current_span(
28
+ # "dependency_span", attributes=tracer_attributes, kind=SpanKind.CLIENT
29
+ # ) as span:
30
+ # try:
31
+ # async with httpx.AsyncClient() as client:
32
+ # response = await client.get("https://www.bing.com")
33
+ # logger.info(f"Received response status code: {response.status_code}")
34
+ # except Exception as ex:
35
+ # span.set_attribute("status", "exception")
36
+ # span.record_exception(ex)
33
37
34
38
return SampleResponse (output = f"Hello { data .input } " )
0 commit comments