Skip to content

Commit 25a446e

Browse files
authored
Merge branch 'main' into issue-15-fix
2 parents 90435c8 + 6ed00bd commit 25a446e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

codeguru_profiler_agent/sampling_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
TRUNCATED_FRAME = Frame(name="<Truncated>")
1111

1212
TIME_SLEEP_FRAME = Frame(name="<Sleep>")
13+
LXML_SCHEMA_FRAME = Frame(name="lxml.etree:XMLSchema:__init__")
1314

1415

1516
def get_stacks(threads_to_sample, excluded_threads, max_depth):
@@ -69,14 +70,16 @@ def _extract_stack(stack, max_depth):
6970
)
7071
if len(stack) < max_depth:
7172
last_frame, last_frame_line_no = stack[-1]
72-
_maybe_append_time_sleep(result, last_frame, last_frame_line_no)
73+
_maybe_append_synthetic_frame(result, last_frame, last_frame_line_no)
7374
return result
7475

7576

76-
def _maybe_append_time_sleep(result, frame, line_no):
77+
def _maybe_append_synthetic_frame(result, frame, line_no):
7778
line = linecache.getline(frame.f_code.co_filename, line_no).strip()
7879
if "sleep(" in line:
7980
result.append(TIME_SLEEP_FRAME)
81+
elif "etree.XMLSchema(" in line:
82+
result.append(LXML_SCHEMA_FRAME)
8083

8184

8285
def _extract_frames(end_frame, max_depth):

0 commit comments

Comments
 (0)