Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cbcb837
feat(profiling): add 'threading.RLock' support to the Lock profiler
vlad-scherbich Oct 8, 2025
5a5da67
add RLock tests
vlad-scherbich Oct 9, 2025
3c44a6b
all TestThreadingLockCollector tests pass; some TestThreadingRLockCol…
vlad-scherbich Oct 9, 2025
9a66d42
some still don't pass; most pass; flaky?
vlad-scherbich Oct 9, 2025
df78a44
fix lints
vlad-scherbich Oct 9, 2025
23e588b
fix test_global_locks test
vlad-scherbich Oct 10, 2025
2ec942e
Simplified and improve: fix test_global_locks test
vlad-scherbich Oct 10, 2025
ae5c322
lint fixes
vlad-scherbich Oct 10, 2025
b0fdf85
fix line-number discrepancy for py versions
vlad-scherbich Oct 10, 2025
e1a1d14
add e2e test
vlad-scherbich Oct 10, 2025
7a67ef3
fix lint
vlad-scherbich Oct 10, 2025
193329b
move the e2e test file into tests dir
vlad-scherbich Oct 10, 2025
d915f33
adding more tests
vlad-scherbich Oct 13, 2025
d665c80
Moving test_user_threads_have_native_id to test_profiler (it doesn't …
vlad-scherbich Oct 13, 2025
2b5a405
Clean up 'test_[r|]lock_gevent_tasks' tests
vlad-scherbich Oct 14, 2025
79a0abd
fix tests (import threading)
vlad-scherbich Oct 14, 2025
ecf4599
Update ddtrace/profiling/collector/threading.py
vlad-scherbich Oct 15, 2025
f38d172
fix tests and rm the e2e test file
vlad-scherbich Oct 15, 2025
ec6ac94
added type hints to test_threading.py
vlad-scherbich Oct 15, 2025
573bb8b
Replaced Any with real types
vlad-scherbich Oct 17, 2025
d8925aa
rebase
vlad-scherbich Oct 24, 2025
5cf51dd
fix lints
vlad-scherbich Oct 24, 2025
a27142d
fix type aliases and imports
vlad-scherbich Oct 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions tests/profiling/collector/lock_utils.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from collections import namedtuple
import sys
from typing import Dict


LineNo = namedtuple("LineNo", ["create", "acquire", "release"])
lock_locs = {}
lock_locs: Dict[str, LineNo] = {}
loc_type_map = {
"!CREATE!": "create",
"!ACQUIRE!": "acquire",
"!RELEASE!": "release",
}


def get_lock_locations(path: str):
def get_lock_locations(path: str) -> None:
"""
The lock profiler is capable of determining where locks are created and used. In order to test this behavior, line
numbers are compared in several tests. However, since it's cumbersome to write the tests in any way except
Expand All @@ -34,12 +35,12 @@ def get_lock_locations(path: str):
lock_locs[lock_name] = lock_locs[lock_name]._replace(**{field: lineno})


def get_lock_linenos(name, with_stmt=False):
def get_lock_linenos(name, with_stmt=False) -> LineNo:
linenos = lock_locs.get(name, LineNo(0, 0, 0))
if with_stmt and sys.version_info < (3, 10):
linenos = linenos._replace(release=linenos.release + 1)
return linenos


def init_linenos(path):
def init_linenos(path) -> None:
get_lock_locations(path)
Loading
Loading