Skip to content

Commit 332cb0b

Browse files
committed
chore(profiling): re-accept interval for memory profile collector [backport 3.12]
In #14205 we removed the `_interval` parameter for the `MemoryCollector`. This was a mistake. Now the memory profile collector thread basically spins in a tight loop because the interval is 0. Add that parameter back. Backports #14276 to the 3.12 branch. This was fixed in 3.12.0 but somehow didn't make it to 3.12.1 or 3.12.2
1 parent 9be6b31 commit 332cb0b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ddtrace/profiling/collector/memalloc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@
3030
class MemoryCollector(collector.PeriodicCollector):
3131
"""Memory allocation collector."""
3232

33+
_DEFAULT_INTERVAL = 0.5
34+
3335
def __init__(
3436
self,
37+
_interval: float = _DEFAULT_INTERVAL,
3538
max_nframe: Optional[int] = None,
3639
heap_sample_size: Optional[int] = None,
3740
ignore_profiler: Optional[bool] = None,
3841
):
3942
super().__init__()
43+
self._interval: float = _interval
4044
# TODO make this dynamic based on the 1. interval and 2. the max number of events allowed in the Recorder
4145
self.max_nframe: int = max_nframe if max_nframe is not None else config.max_frames
4246
self.heap_sample_size: int = heap_sample_size if heap_sample_size is not None else config.heap.sample_size

0 commit comments

Comments
 (0)