Browse Source

feat(getting-started): add slow and fast example functions to profiling onboarding (#80886)

Simon Hellmayr 3 months ago
parent
commit
044263acbd
1 changed files with 13 additions and 1 deletions
  1. 13 1
      static/app/gettingStartedDocs/python/python.tsx

+ 13 - 1
static/app/gettingStartedDocs/python/python.tsx

@@ -45,10 +45,22 @@ sentry_sdk.init(
   params.profilingOptions?.defaultProfilingMode === 'continuous'
     ? `
 
+def slow_function():
+    import time
+    time.sleep(0.1)
+    return "done"
+
+def fast_function():
+    import time
+    time.sleep(0.05)
+    return "done"
+
 # Manually call start_profiler and stop_profiler
 # to profile the code in between
 sentry_sdk.profiler.start_profiler()
-# this code will be profiled
+for i in range(0, 10):
+    slow_function()
+    fast_function()
 #
 # Calls to stop_profiler are optional - if you don't stop the profiler, it will keep profiling
 # your application until the process exits or stop_profiler is called.