1010GZIP_BALANCED_COMPRESSION_LEVEL = 6
1111DEFAULT_FRAME_COMPONENT_DELIMITER = ":"
1212
13-
1413def _get_module_path (file_path , sys_paths ):
1514 """
1615 We tried to remove the python library root path in order to give a reasonable expression of the module path.
@@ -23,6 +22,12 @@ def _get_module_path(file_path, sys_paths):
2322 will get turned into `polls.views' given that the file path contains the current path.
2423 This should not happen usually, but we've found a case where the "/." is added when calling traceback.walk_stack(..)
2524 in a uwsgi application. Check sampling_utils.py file for details.
25+
26+ sampling_utils.py returns different values when calling traceback.walk_stack(..) for uwsgi vs non-uwsgi
27+ for Python 3.8.10-Python 3.9.2.
28+ Examples of results:
29+ - file '/Users/mirelap/Documents/workspace/JSON/aws-codeguru-profiler-python-demo-application/sample-demo-django-app/./polls/views.py', line 104, code get_queryset>, 104
30+ - file '/Users/mirelap/Documents/workspace/JSON/aws-codeguru-profiler-python-demo-application/sample-demo-django-app/polls/views.py', line 104, code get_queryset>, 104
2631 """
2732 module_path = file_path
2833
@@ -49,7 +54,7 @@ def _get_module_path(file_path, sys_paths):
4954def _remove_prefix_path (module_path , sys_paths ):
5055 current_path = str (Path ().absolute ())
5156 if current_path in module_path :
52- return module_path .replace (current_path , "" ).replace ("/." , "" )
57+ return module_path .replace (current_path , "" ).replace ("/./ " , "/ " )
5358 for root in sys_paths :
5459 if root in module_path :
5560 return module_path .replace (root , "" )
0 commit comments