-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(profiling): Continuous profiling lifecycle #4017
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.