feat(profiling): Continuous profiling lifecycle#4017
Conversation
This introduces auto lifecycle setting for continuous profiling to only profile while there is an active transaction. This replaces the experimental auto start setting.
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky tests
To view more test analytics, go to the Test Analytics Dashboard |
| self.started_spans = deque(maxlen=128) # type: Deque[None] | ||
| self.finished_spans = deque(maxlen=128) # type: Deque[None] |
There was a problem hiding this comment.
What's the thought behind having these be deques? Is it so that the counters are thread safe?
There was a problem hiding this comment.
Yes. Because we need to count the number of active spans (just transactions here) in order to determine if we should run the profiler. This is tracked across all threads so we need a thread safe way of counting them. To avoid using a python lock which can have significant performance impact, we work around it with a deque.
I'm also updating it to reflect the implementation in transaction_profiler.py more as I realize this current implementation can have some issues when the deque overflows while the other implementation handles it better.
This introduces auto lifecycle setting for continuous profiling to only profile while there is an active transaction. This replaces the experimental auto start setting.