1111import epsagon .trace
1212from epsagon .runners .tornado import TornadoRunner
1313from epsagon .http_filters import ignore_request , is_ignored_endpoint
14- from epsagon .utils import collect_container_metadata , print_debug
14+ from epsagon .utils import collect_container_metadata
1515
1616TORNADO_TRACE_ID = 'epsagon_tornado_trace_key'
1717
@@ -31,7 +31,6 @@ def before_request(cls, wrapped, instance, args, kwargs):
3131 :param args: wrapt's args
3232 :param kwargs: wrapt's kwargs
3333 """
34- print_debug ('before_request Tornado request' )
3534 try :
3635 ignored = ignore_request ('' , instance .request .path )
3736 if not ignored and not is_ignored_endpoint (instance .request .path ):
@@ -49,7 +48,6 @@ def before_request(cls, wrapped, instance, args, kwargs):
4948 )
5049
5150 trace .set_runner (cls .RUNNERS [unique_id ])
52- print_debug ('Created Tornado Runner' )
5351
5452 # Collect metadata in case this is a container.
5553 collect_container_metadata (
@@ -71,18 +69,9 @@ def after_request(cls, wrapped, instance, args, kwargs):
7169 :param args: wrapt's args
7270 :param kwargs: wrapt's kwargs
7371 """
74- print_debug ('after_request Tornado request' )
75- response_body = None
76- try :
77- response_body = getattr (instance , '_write_buffer' , None )
78- if response_body and isinstance (response_body , list ):
79- response_body = b'' .join (response_body )
80- except Exception as instrumentation_exception : # pylint: disable=W0703
81- epsagon .trace .trace_factory .add_exception (
82- instrumentation_exception ,
83- traceback .format_exc ()
84- )
85-
72+ response_body = getattr (instance , '_write_buffer' , None )
73+ if response_body and isinstance (response_body , list ):
74+ response_body = b'' .join (response_body )
8675 res = wrapped (* args , ** kwargs )
8776 try :
8877 unique_id = getattr (instance , TORNADO_TRACE_ID , None )
@@ -91,11 +80,6 @@ def after_request(cls, wrapped, instance, args, kwargs):
9180
9281 tornado_runner = cls .RUNNERS .pop (unique_id )
9382
94- # Ignoring 404s
95- if getattr (instance , '_status_code' , None ) == 404 :
96- print_debug ('Ignoring 404 Tornado request' )
97- return res
98-
9983 trace = epsagon .trace .trace_factory .switch_active_trace (
10084 unique_id
10185 )
@@ -127,7 +111,6 @@ def collect_exception(cls, wrapped, instance, args, kwargs):
127111 :param args: wrapt's args
128112 :param kwargs: wrapt's kwargs
129113 """
130- print_debug ('collect_exception Tornado request' )
131114 try :
132115 unique_id = getattr (instance , TORNADO_TRACE_ID , None )
133116
0 commit comments