Skip to content

Commit

Permalink
fix(profiling): Need to sample profile correctly (#1679)
Browse files Browse the repository at this point in the history
This is fixing a mistake from #1676, and adding a sample at the start of the
profile instead of waiting 1 interval before getting the first sample.
  • Loading branch information
Zylphrex committed Oct 13, 2022
1 parent 40993fe commit bb879ab
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sentry_sdk/profiler.py
Expand Up @@ -454,6 +454,8 @@ def make_run(self, event):

def run():
# type: () -> None
self.sampler()

last = time.perf_counter()

while True:
Expand All @@ -471,7 +473,7 @@ def run():
if event.is_set():
break

self.sampler()
self.sampler()

return run

Expand All @@ -490,6 +492,8 @@ def make_run(self, event):

def run():
# type: () -> None
self.sampler()

while True:
event.wait(timeout=self._interval)

Expand All @@ -498,8 +502,6 @@ def run():

self.sampler()

self.sampler()

return run


Expand Down

0 comments on commit bb879ab

Please sign in to comment.