Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Migrate to the new Sentry client

Marcin Gębala8b702026ca75
diff --git a/.isort.cfg b/.isort.cfg
index 5277c61451..9dee5c09e8 100644
--- a/.isort.cfg
+++ b/.isort.cfg
@@ -1,2 +1,2 @@
[settings]
-known_third_party = PIL,babel,bleach,bootstrap4,braintree,captcha,celery,dj_database_url,dj_email_url,django,django_babel,django_cache_url,django_countries,django_elasticsearch_dsl,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,elasticsearch_dsl,faker,freezegun,geolite2,google_measurement_protocol,graphene,graphene_django,graphene_django_optimizer,graphql,graphql_jwt,graphql_relay,html5lib,html_to_draftjs,i18naddress,impersonate,markdown,measurement,mptt,phonenumber_field,phonenumbers,prices,promise,pytest,razorpay,requests,six,social_core,storages,stripe,templated_email,text_unidecode,versatileimagefield
+known_third_party = PIL,babel,bleach,bootstrap4,braintree,captcha,celery,dj_database_url,dj_email_url,django,django_babel,django_cache_url,django_countries,django_elasticsearch_dsl,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,elasticsearch_dsl,faker,freezegun,geolite2,google_measurement_protocol,graphene,graphene_django,graphene_django_optimizer,graphql,graphql_jwt,graphql_relay,html5lib,html_to_draftjs,i18naddress,impersonate,markdown,measurement,mptt,phonenumber_field,phonenumbers,prices,promise,pytest,razorpay,requests,sentry_sdk,six,social_core,storages,stripe,templated_email,text_unidecode,versatileimagefield
diff --git a/Pipfile b/Pipfile
index 95d7d58cfb..4b8f0f9e1a 100644
--- a/Pipfile
+++ b/Pipfile
@@ -48,7 +48,6 @@ phonenumberslite = ">=8.10.10"
prices = ">=1.0.0"
"psycopg2-binary" = ">=2.7"
purl = ">=0.4.1"
-raven = "==6.9.0"
requests = ">=1.2.0"
social-auth-app-django = ">=2.0.0"
text-unidecode = "*"
@@ -65,6 +64,7 @@ stripe = "*"
dataclasses = {version = "*",markers = "python_version < '3.7'"}
html-to-draftjs = "*"
draftjs-sanitizer = "*"
+sentry-sdk = "*"
[dev-packages]
pytest = "*"
diff --git a/Pipfile.lock b/Pipfile.lock
index 55c94d1c3f..42d76d8084 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
- "sha256": "6d78721e8e5cd24c55a9a9a1705ea1a32124beb42950c86115247f5ea3bf9960"
+ "sha256": "30f437160cbabae3058b1d934fc5812b0c3ca2d90b5322744a2bf763eaf34605"
},
"pipfile-spec": 6,
"requires": {
@@ -891,14 +891,6 @@
],
"version": "==2019.2"
},
- "raven": {
- "hashes": [
- "sha256:3fd787d19ebb49919268f06f19310e8112d619ef364f7989246fc8753d469888",
- "sha256:95f44f3ea2c1b176d5450df4becdb96c15bf2632888f9ab193e9dd22300ce46a"
- ],
- "index": "pypi",
- "version": "==6.9.0"
- },
"razorpay": {
"hashes": [
"sha256:0bea9e11aca8024af0cd741b779cb6d3b0a689a8488e21b5e4b345f8840a0fe4",
@@ -951,6 +943,14 @@
],
"version": "==0.2.1"
},
+ "sentry-sdk": {
+ "hashes": [
+ "sha256:d491aa6399eaa3eded433972751a9770180730fd8b4c225b0b7f49c4fa2af70b",
+ "sha256:d68003cdffbbfcadaa2c445b72e1050b0a44406f94199866f192986c016b23f5"
+ ],
+ "index": "pypi",
+ "version": "==0.10.2"
+ },
"singledispatch": {
"hashes": [
"sha256:5b06af87df13818d14f08a028e42f566640aef80805c3b50c5056b086e3c2b9c",
diff --git a/docs/gettingstarted/configuration.rst b/docs/gettingstarted/configuration.rst
index a398433b41..b46dcd25b5 100644
--- a/docs/gettingstarted/configuration.rst
+++ b/docs/gettingstarted/configuration.rst
@@ -86,7 +86,7 @@ Environment variables
Controls `Django's secret key <https://docs.djangoproject.com/en/2.1/ref/settings/#s-secret-key>`_ setting.
``SENTRY_DSN``
- Sentry's `Data Source Name <https://docs.sentry.io/quickstart/#about-the-dsn>`_. Disabled by default, allows to enable integration with Sentry (see :ref:`sentry-integration` for details).
+ Sentry's `Data Source Name <https://docs.sentry.io/error-reporting/configuration/?platform=python#dsn>`_. Disabled by default, allows to enable integration with Sentry (see :ref:`sentry-integration` for details).
``MAX_CART_LINE_QUANTITY``
Controls maximum number of items in one cart line. Defaults to ``50``.
diff --git a/docs/integrations/sentry.rst b/docs/integrations/sentry.rst
index f4318dfb97..026d0eb8da 100644
--- a/docs/integrations/sentry.rst
+++ b/docs/integrations/sentry.rst
@@ -11,4 +11,4 @@ To enable basic error reporting you have to export an environment variable:
Sentry Data Source Name
-If you need to customize the service, please go to the `official Sentry's documentation for Django <https://docs.sentry.io/clients/python/integrations/django/>`_ for more details.
+If you need to customize the service, please go to the `official Sentry's documentation for Django <https://docs.sentry.io/platforms/python/django/>`_ for more details.
diff --git a/requirements.txt b/requirements.txt
index 6772a5b136..fc098532e6 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -99,7 +99,6 @@ pyphen==0.9.5
python-dateutil==2.8.0 ; python_version >= '2.7'
python3-openid==3.1.0 ; python_version >= '3.0'
pytz==2019.2
-raven==6.9.0
razorpay==1.2.0
redis==3.3.5
requests-oauthlib==1.2.0
@@ -107,6 +106,7 @@ requests==2.22.0
rsa==4.0
rx==1.6.1
s3transfer==0.2.1
+sentry-sdk==0.10.2
singledispatch==3.4.0.3
six==1.12.0
social-auth-app-django==3.1.0
diff --git a/saleor/settings.py b/saleor/settings.py
index 77ad37faa7..b8f0057d40 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -5,11 +5,11 @@ import warnings
import dj_database_url
import dj_email_url
import django_cache_url
+import sentry_sdk
from django.contrib.messages import constants as messages
from django.utils.translation import gettext_lazy as _, pgettext_lazy
from django_prices.templatetags.prices_i18n import get_currency_fraction
-
-from . import __version__
+from sentry_sdk.integrations.django import DjangoIntegration
def get_list(text):
@@ -592,8 +592,7 @@ RECAPTCHA_PRIVATE_KEY = os.environ.get("RECAPTCHA_PRIVATE_KEY")
# Sentry
SENTRY_DSN = os.environ.get("SENTRY_DSN")
if SENTRY_DSN:
- INSTALLED_APPS.append("raven.contrib.django.raven_compat")
- RAVEN_CONFIG = {"dsn": SENTRY_DSN, "release": __version__}
+ sentry_sdk.init(dsn=SENTRY_DSN, integrations=[DjangoIntegration()])
SERIALIZATION_MODULES = {"json": "saleor.core.utils.json_serializer"}