Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Zylphrex
Copy link
Member

@Zylphrex Zylphrex commented Feb 4, 2025

This introduces auto lifecycle setting for continuous profiling to only profile while there is an active transaction. This replaces the experimental auto start setting.

This introduces auto lifecycle setting for continuous profiling to only profile
while there is an active transaction. This replaces the experimental auto start
setting.
Copy link

codecov bot commented Feb 4, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
22555 1 22554 5819
View the full list of 1 ❄️ flaky tests
tests.integrations.stdlib.test_httplib test_http_timeout

Flake rate in main: 51.19% (Passed 41 times, Failed 43 times)

Stack Traces | 0.189s run time
.../integrations/stdlib/test_httplib.py:418: in test_http_timeout
    assert len(transaction["spans"]) == 1
E   assert 0 == 1
E    +  where 0 = len([])

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Comment on lines 217 to 218
self.started_spans = deque(maxlen=128) # type: Deque[None]
self.finished_spans = deque(maxlen=128) # type: Deque[None]
Copy link
Contributor

@sentrivana sentrivana Feb 7, 2025

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?

Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants