Skip to content

Slow performance when Sentry integration is enabled #1893

@piotrpawlaczek

Description

@piotrpawlaczek

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

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions