Skip to content

Commit b03df2c

Browse files
authored
Merge pull request #11499 from internetarchive/fix/ignore-httpx-in-pyspy-monitoring
Ignore httpx in pyspy monitoring like we do requests
2 parents ad566c7 + de3132c commit b03df2c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/monitoring/utils.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Note: The code in here is tested by scripts/monitoring/tests/test_utils_sh.py
22

3+
find_worker_pids() {
4+
ps aux | grep -E 'openlibrary-server|coverstore-server' | grep -v 'grep' | awk '{print $2}'
5+
}
6+
export -f find_worker_pids
7+
38
py_spy_cur_fn() {
49
pid=$1
510

@@ -12,7 +17,7 @@ py_spy_cur_fn() {
1217

1318
py-spy dump --nonblocking --pid $pid \
1419
| grep -vE '^(Process|Python|Thread)' \
15-
| grep -vE '(\bssl\.py|(readinto) .*socket\.py|http/client\.py|sentry_sdk|urllib3/connection\.py|<genexpr>|urllib3/connectionpool\.py|requests/(api|adapters|sessions)\.py)' \
20+
| grep -vE '(\bssl\.py|(readinto) .*socket\.py|http/client\.py|sentry_sdk|urllib3/connection\.py|<genexpr>|urllib3/connectionpool\.py|requests/(api|adapters|sessions)\.py|httpcore/|httpx/)' \
1621
| head -n2 | tail -n1
1722
}
1823
export -f py_spy_cur_fn
@@ -59,7 +64,7 @@ log_workers_cur_fn() {
5964
# related to requests connection pooling
6065
# - get_availability|get_api_response: Main time block for IA requests
6166

62-
for pid in $(ps aux | grep -E 'openlibrary-server|coverstore-server' | grep -v 'grep' | awk '{print $2}'); do
67+
for pid in $(find_worker_pids); do
6368
echo "$pid $(py_spy_cur_fn $pid)";
6469
done 2>/dev/null \
6570
| awk '{$1=""; print}' \

0 commit comments

Comments
 (0)