Skip to content

chore(profiling): Update python profiling docs for new SDK #85560

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

Closed

Conversation

Zylphrex
Copy link
Member

@Zylphrex Zylphrex commented Feb 20, 2025

This uses the updated python sdk where

  • _experiments["continuous_profiling_auto_start"] is replaced by profile_lifecycle
    • this differs slightly to only profile traces instead of all the time

This uses the updated python sdk where
- `start_profiler` is replaced by `start_profile_session`
- `stop_profiler` is replaced by `stop_profiler_session`
- `_experiments["continuous_profiling_auto_start"]` is replaced by `profile_lifecycle`
	- this differs slightly to only profile traces instead of all the time
@Zylphrex Zylphrex requested a review from a team as a code owner February 20, 2025 18:39
@Zylphrex Zylphrex requested a review from a team February 20, 2025 18:39
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 20, 2025
@Zylphrex
Copy link
Member Author

Need to wait until getsentry/sentry-python#4079 is in a release

Copy link

codecov bot commented Mar 17, 2025

❌ 28 Tests Failed:

Tests completed Failed Passed Skipped
10046 28 10018 11
View the top 3 failed test(s) by shortest run time
tryton onboarding docs renders continuous profiling
Stack Traces | 0.027s run time
Error: expect(element).not.toBeInTheDocument()

expected document not to contain element, found <code class="language-python css-3u28qi-Code ekl9mf40">import sentry_sdk
from sentry_sdk.integrations.trytond import TrytondWSGIIntegration

sentry_sdk.init(
    dsn="test-dsn",
    integrations=[TrytondWSGIIntegration()],
    # Add data like request headers and IP for users,
    # see https://docs.sentry..../python/data-management/data-collected/ for more info
    send_default_pii=True,
    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for tracing.
    traces_sample_rate=1.0,
    # Set profile_session_sample_rate to 1.0 to profile 100%
    # of profile sessions.
    profile_session_sample_rate=1.0,
    # Set profile_lifecycle to "trace" to automatically
    # run the profiler on when there is an active transaction
    profile_lifecycle="trace",
)

from trytond.application import app as application

# ...</code> instead
    at Object.<anonymous> (.../gettingStartedDocs/python/tryton.spec.tsx:48:129)
    at Promise.then.completed (.../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at _runTest (.../jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:121:9)
    at run (.../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../jest-runner/build/testWorker.js:106:12)
chalice onboarding docs renders continuous profiling
Stack Traces | 0.034s run time
Error: expect(element).not.toBeInTheDocument()

expected document not to contain element, found <code class="language-python css-3u28qi-Code ekl9mf40">import sentry_sdk
from chalice import Chalice

from sentry_sdk.integrations.chalice import ChaliceIntegration

sentry_sdk.init(
    dsn="test-dsn",
    integrations=[ChaliceIntegration()],
    # Add data like request headers and IP for users,
    # see https://docs.sentry..../python/data-management/data-collected/ for more info
    send_default_pii=True,
    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for tracing.
    traces_sample_rate=1.0,
    # Set profile_session_sample_rate to 1.0 to profile 100%
    # of profile sessions.
    profile_session_sample_rate=1.0,
    # Set profile_lifecycle to "trace" to automatically
    # run the profiler on when there is an active transaction
    profile_lifecycle="trace",
)

app = Chalice(app_name="appname")</code> instead
    at Object.<anonymous> (.../gettingStartedDocs/python/chalice.spec.tsx:57:129)
    at Promise.then.completed (.../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at _runTest (.../jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:121:9)
    at run (.../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../jest-runner/build/testWorker.js:106:12)
django onboarding docs renders continuous profiling
Stack Traces | 0.036s run time
Error: expect(element).not.toBeInTheDocument()

expected document not to contain element, found <code class="language-python css-3u28qi-Code ekl9mf40">import sentry_sdk

sentry_sdk.init(
    dsn="test-dsn",
    # Add data like request headers and IP for users,
    # see https://docs.sentry..../python/data-management/data-collected/ for more info
    send_default_pii=True,
    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for tracing.
    traces_sample_rate=1.0,
    # Set profile_session_sample_rate to 1.0 to profile 100%
    # of profile sessions.
    profile_session_sample_rate=1.0,
    # Set profile_lifecycle to "trace" to automatically
    # run the profiler on when there is an active transaction
    profile_lifecycle="trace",
)</code> instead
    at Object.<anonymous> (.../gettingStartedDocs/python/django.spec.tsx:57:129)
    at Promise.then.completed (.../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at _runTest (.../jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:121:9)
    at run (.../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../jest-runner/build/testWorker.js:106:12)

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

Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my inline comment.

Also, our Docs page says continuous profiling is still in Beta. Is this accurate? If yes, maybe we should wait until this is out of beta to merge this change; otherwise, let's remove the Beta notice from the Docs page.

instead of start_profile_session and stop_profile_session
@Zylphrex Zylphrex closed this Mar 31, 2025
@Zylphrex Zylphrex deleted the txiao/chore/update-python-profiling-docs-for-new-sdk branch March 31, 2025 15:21
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants