You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently decided to switch from Raven to sentry-sdk version 0.7.3.
When an event was reported using Raven I use to have many useful tags (the URLs originating the error, the user browser/device, OS information and much more). All this comes out of the box without the need to include any scripts in the frontend.
Despite sentry-sdk has simplified the configuration process I find myself with a weaker error tracking system (fewer information on each event).
I am working on a Django project and followed the docs
The tags you see are generated serverside and are inferred from HTTP headers and the current URL. All of this should be there when you turn on the Django integration. We're using this for Sentry itself and it generally is supposed to work.
From what you've told me it seems that you generally have no request data attached to your events. Could you paste the exact code you're using, and more importantly, where do you call init of the SDK?
@untitaker oops, sorry for delay.. I just put the docs code (with init sentry) at the end of my settings file and I haven't defined any LOGGING configuration.
From what you've told me it seems that you generally have no request data attached to your events.
Yes, that's the issue. My previously working logging configuration with Raven was:
I am also experiencing the same thing. Very similar setup to the one described by @bluesurfer. The Raven Python setup included a 'Cookies' section as well as better 'User' information (these both seem to be Django request object information).
I am using Django 1.11.20, Python 3.6.7 and was trying Sentry 0.8.0.
I am following cookiecutter-django repository to lay down my project. It seems that with recent updates (also from sentry-sdk) the following configuration to me is working:
@untitaker I am getting circular settings import issue after upgrading to 0.9.1
please check below stack trace once
File ".venv/local/lib/python2.7/site-packages/sentry_sdk/hub.py", line 74, in init
client = Client(*args, **kwargs)
File ".venv/local/lib/python2.7/site-packages/sentry_sdk/client.py", line 88, in __init__
options["integrations"], with_defaults=options["default_integrations"]
File ".venv/local/lib/python2.7/site-packages/sentry_sdk/integrations/__init__.py", line 80, in setup_integrations
type(integration).setup_once()
File ".venv/local/lib/python2.7/site-packages/sentry_sdk/integrations/django/__init__.py", line 128, in setup_once
from rest_framework.views import APIView # type: ignore
File ".venv/local/lib/python2.7/site-packages/rest_framework/views.py", line 18, in <module>
from rest_framework import exceptions, status
File ".venv/local/lib/python2.7/site-packages/rest_framework/exceptions.py", line 17, in <module>
from rest_framework.utils.serializer_helpers import ReturnDict, ReturnList
File ".venv/local/lib/python2.7/site-packages/rest_framework/utils/serializer_helpers.py", line 9, in <module>
from rest_framework.compat import unicode_to_repr
File ".venv/local/lib/python2.7/site-packages/rest_framework/compat.py", line 156, in <module>
from django.contrib.postgres import fields as postgres_fields
File ".venv/local/lib/python2.7/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
from .array import * # NOQA
File ".venv/local/lib/python2.7/site-packages/django/contrib/postgres/fields/array.py", line 3, in <module>
from django.contrib.postgres import lookups
File ".venv/local/lib/python2.7/site-packages/django/contrib/postgres/lookups.py", line 4, in <module>
from .search import SearchVector, SearchVectorExact, SearchVectorField
File ".venv/local/lib/python2.7/site-packages/django/contrib/postgres/search.py", line 47, in <module>
class SearchVector(SearchVectorCombinable, Func):
File ".venv/local/lib/python2.7/site-packages/django/contrib/postgres/search.py", line 50, in SearchVector
_output_field = SearchVectorField()
File ".venv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 172, in __init__
self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
File ".venv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File ".venv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File ".venv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 129, in __init__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
Activity
[-]Where are all the Raven (deprecated) default tags?[/-][+]Where are all the Raven default tags?[/+]untitaker commentedon Feb 19, 2019
The tags you see are generated serverside and are inferred from HTTP headers and the current URL. All of this should be there when you turn on the Django integration. We're using this for Sentry itself and it generally is supposed to work.
From what you've told me it seems that you generally have no request data attached to your events. Could you paste the exact code you're using, and more importantly, where do you call
initof the SDK?untitaker commentedon Feb 24, 2019
@bluesurfer any update on this? This seems like a bug in the SDK, even if just a UX bug.
bluesurfer commentedon Feb 24, 2019
@untitaker oops, sorry for delay.. I just put the docs code (with init sentry) at the end of my settings file and I haven't defined any
LOGGINGconfiguration.Yes, that's the issue. My previously working logging configuration with Raven was:
Than using sentry-sdk I simply replaced it with:
untitaker commentedon Feb 24, 2019
Which version of Django and Python are you using?
bluesurfer commentedon Feb 24, 2019
@untitaker Django 2.1.7 with python 3.6.7.
Also I am using Channels
[-]Where are all the Raven default tags?[/-][+]No request data with django[/+]bcollazo commentedon May 22, 2019
I am also experiencing the same thing. Very similar setup to the one described by @bluesurfer. The Raven Python setup included a 'Cookies' section as well as better 'User' information (these both seem to be Django
requestobject information).I am using Django 1.11.20, Python 3.6.7 and was trying Sentry 0.8.0.
bluesurfer commentedon May 23, 2019
@bcollazo @untitaker I have some updates.
I am following cookiecutter-django repository to lay down my project. It seems that with recent updates (also from sentry-sdk) the following configuration to me is working:
Therefore to me this issue could be closed.
untitaker commentedon May 23, 2019
Ah that's neat, I wasn't aware of cookiecutter/cookiecutter-django#1820!
Tbh I think it's highly unlikely that @bluesurfer has the same actual problem as you, @bcollazo. Could you open a new issue with more information?
anush0247 commentedon May 31, 2019
We are also facing the same issue
We are not getting the Django request data info in sentry console with updated sentry SDK
With old raven Django client, there is no issue about getting request data in sentry
We are getting request data in sentry console, only if there is some exception raised before our program did access the request.body
We are getting
can't read requst data once its already readerror atsentry_sdk.integrations.django.DjangoRequestExtractor#raw_datauntitaker commentedon May 31, 2019
@anush0247 could you link an event that exhibits this behavior?
test(django): Add test for read bodies, see #267
anush0247 commentedon Jun 3, 2019
@untitaker please find below link
https://sentry.io/organizations/backend-developers/issues/1054285117/?project=240166&query=is%3Aunresolved
anush0247 commentedon Jun 19, 2019
@untitaker any update ?
untitaker commentedon Jun 19, 2019
untitaker commentedon Jun 19, 2019
PR at #393... I am pretty sure the issue is with django-rest-framework and not Django.
untitaker commentedon Jun 21, 2019
0.9.1 is out with this fix :) I hope it fixes all cases, but certainly should fix a few of them
anush0247 commentedon Jun 25, 2019
@untitaker I am getting circular settings import issue after upgrading to 0.9.1
please check below stack trace once
untitaker commentedon Jun 25, 2019
@anush0247 the issue has been reported as #397 and is fixed in 0.9.2 :)
anush0247 commentedon Jun 26, 2019
@untitaker thank you it's working now