-
Notifications
You must be signed in to change notification settings - Fork 7
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
django-q-sentry breaks normal Sentry integration #12
Comments
The workaround I'm running is as follows:
Q_CLUSTER = {
'name': 'django_q_backend',
'max_attempts': 1,
'redis': {
'host': REDIS_HOSTNAME,
'port': REDIS_PORT,
'db': REDIS_DB,
}
...
}
SENTRY_CONFIG = {
'dsn': SENTRY_DSN,
'integrations': [DjangoIntegration()],
'debug': DEBUG,
'send_default_pii': True,
...
}
sentry_sdk.init(**SENTRY_CONFIG)
Q_CLUSTER['error_reporter'] = {
'sentry': SENTRY_CONFIG
} |
Did you find using |
I didn't test it without
I think I solved this issue by following the suggestion in Koed00/django-q#463 (comment) So having for example the following model: class User:
first_name: str
last_name: int
email: str
def send_account_activation_email():
... Instead of doing: new_user = User(...)
async_task(new_user.send_account_activation_email) You can do something like: class BgTasks:
@classmethod
def send_account_activation_email(cls, u: User):
u.send_account_activation_email()
new_user = User(...)
async_task(BgTasks.send_account_activation_email) |
@gdalmau Thank you for your response!
Sorry, do you mean this solves the truncated stacktrace or the error titles? Most of our |
If you follow the current docs for using Sentry with Python/Django you will add something like the following code to your settings.py:
If you then follow the django-q-sentry docs, you will also add this:
The problem is that doing this will break your earlier config. In particular, I noticed that the performance tracing was not working at all - Sentry was not receiving any performance traces. When I disabled the
error_report
key in theQ_CLUSTER
setting, it started working.Digging it, it looks like django-q-sentry does its own call to
sentry_sdk.init
indjango-q-sentry/django_q_sentry/sentry.py
Line 45 in c2d0846
With django-q-sentry disabled, it appears that Sentry works just fine for reporting crashes inside my tasks. So is django-q-sentry needed at all? Would it be best to deprecate this package?
The text was updated successfully, but these errors were encountered: