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

Slow performance when Sentry integration is enabled #1893

Closed
piotrpawlaczek opened this issue Feb 9, 2023 · 3 comments · Fixed by #1929
Closed

Slow performance when Sentry integration is enabled #1893

piotrpawlaczek opened this issue Feb 9, 2023 · 3 comments · Fixed by #1929
Assignees

Comments

@piotrpawlaczek
Copy link

piotrpawlaczek commented Feb 9, 2023

How do you use Sentry?

Sentry Saas (sentry.io)

Version

1.11.1

Steps to Reproduce

Set the environment variable SENTRY_ENABLED to True
Run the command: python manage.py sqlmigrate app

Record the time taken.

Python version: 3.9.15
Django version: 3.2.17
Os version: Debian 10.13 Slim

if SENTRY_DSN and SENTRY_ENABLED and not BUILD_MODE and not TEST_MODE:
    sentry_sdk.init(
        release=f"app@{VERSION}",
        environment=ENVIRONMENT,
        integrations=[DjangoIntegration()],
        ignore_errors=SENTRY_IGNORE_EXCEPTIONS,
        send_default_pii=True,
        sample_rate=min(SENTRY_EVENTS_SAMPLE_RATE, 1.0),
        traces_sample_rate=min(SENTRY_TRACES_SAMPLE_RATE, 1.0),
    )

Expected Result

We have noticed that there is a significant impact on performance when the Sentry integration is enabled.

time SENTRY_ENABLED=False ./src/manage.py sqlmigrate app
13min

time SENTRY_ENABLED=True ./src/manage.py sqlmigrate app
~14min

Actual Result

time SENTRY_ENABLED=False ./src/manage.py sqlmigrate app
13min

time SENTRY_ENABLED=True ./src/manage.py sqlmigrate app
28min

Screenshot 2023-02-09 at 18 00 58

@sl0thentr0py
Copy link
Member

@antonpirker as discussed, please disable signals instrumentation by default and make it opt-in.

@ron8mcr
Copy link

ron8mcr commented Feb 28, 2023

Looks similar to #1826

@antonpirker
Copy link
Member

Because we have already a option middleware_spans that defaults to True, I will make the spans thing also default to true: https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/integrations/django/__init__.py#L94
fyi @sl0thentr0py

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