File tree Expand file tree Collapse file tree 3 files changed +507
-415
lines changed Expand file tree Collapse file tree 3 files changed +507
-415
lines changed Original file line number Diff line number Diff line change @@ -20,13 +20,14 @@ def __init__(self, app):
2020 self .app = app
2121
2222 def _extract_custom_headers (self , span , headers ):
23+ if agent .options .extra_http_headers is None :
24+ return
2325 try :
24- if agent .options .extra_http_headers is not None :
25- for custom_header in agent .options .extra_http_headers :
26- # Headers are in the following format: b'x-header-1'
27- for header_pair in headers :
28- if header_pair [0 ].decode ('utf-8' ).lower () == custom_header .lower ():
29- span .set_tag ("http.header.%s" % custom_header , header_pair [1 ].decode ('utf-8' ))
26+ for custom_header in agent .options .extra_http_headers :
27+ # Headers are in the following format: b'x-header-1'
28+ for header_pair in headers :
29+ if header_pair [0 ].decode ('utf-8' ).lower () == custom_header .lower ():
30+ span .set_tag ("http.header.%s" % custom_header , header_pair [1 ].decode ('utf-8' ))
3031 except Exception :
3132 logger .debug ("extract_custom_headers: " , exc_info = True )
3233
Original file line number Diff line number Diff line change @@ -26,8 +26,11 @@ async def user(user_id):
2626
2727@fastapi_server .get ("/response_headers" )
2828async def response_headers ():
29- headers = {'X-Capture-This-Too' : 'this too' }
30- return Response (content = None , headers = headers )
29+ headers = {
30+ 'X-Capture-This-Too' : 'this too' ,
31+ 'X-Capture-That-Too' : 'that too'
32+ }
33+ return Response ("Stan wuz here with headers!" , headers = headers )
3134
3235@fastapi_server .get ("/400" )
3336async def four_zero_zero ():
You can’t perform that action at this time.
0 commit comments