Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Remove Sentry integrated client
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Mar 29, 2015
1 parent 4899aa0 commit 1deda05
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 63 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -2,6 +2,7 @@ Version 5.3.0
-------------

* The UDP transport has been removed.
* The integrated Sentry+Django client has been removed. This is now part of Sentry core.

Version 5.2.0
-------------
Expand Down
4 changes: 1 addition & 3 deletions raven/base.py
Expand Up @@ -92,9 +92,7 @@ def did_fail(self):

class Client(object):
"""
The base Raven client, which handles both local direct
communication with Sentry (through the GroupedMessage API), as
well as communicating over the HTTP API to multiple servers.
The base Raven client.
Will read default configuration from the environment variable
``SENTRY_DSN`` if available.
Expand Down
27 changes: 0 additions & 27 deletions raven/contrib/django/client.py
Expand Up @@ -27,9 +27,6 @@
class DjangoClient(Client):
logger = logging.getLogger('sentry.errors.client.django')

def is_enabled(self):
return bool(self.servers or 'sentry' in settings.INSTALLED_APPS)

def get_user_info(self, user):
if not user.is_authenticated():
return {'is_authenticated': False}
Expand Down Expand Up @@ -167,27 +164,3 @@ def capture(self, event_type, request=None, **kwargs):
}

return result

def send(self, **kwargs):
"""
Serializes and signs ``data`` and passes the payload off to ``send_remote``
If ``servers`` was passed into the constructor, this will serialize the data and pipe it to
each server using ``send_remote()``. Otherwise, this will communicate with ``sentry.models.GroupedMessage``
directly.
"""
if self.servers:
return super(DjangoClient, self).send(**kwargs)
elif 'sentry' in settings.INSTALLED_APPS:
try:
return self.send_integrated(kwargs)
except Exception as e:
if self.raise_send_errors:
raise
self.error_logger.error(
'Unable to record event: %s\nEvent was: %r', e,
kwargs['message'], exc_info=True)

def send_integrated(self, kwargs):
from sentry.models import Group
return Group.objects.from_kwargs(**kwargs)
13 changes: 4 additions & 9 deletions raven/contrib/django/management/__init__.py
Expand Up @@ -28,21 +28,16 @@ def patch_base_command(cls):
if hasattr(original_func, '__raven_patched'):
return False

def can_capture(cls):
return 'sentry' not in settings.INSTALLED_APPS

@wraps(original_func)
def new_execute(self, *args, **kwargs):
try:
return original_func(self, *args, **kwargs)
except Exception:
from raven.contrib.django.models import client

if can_capture(type(self)):
from raven.contrib.django.models import client

client.captureException(extra={
'argv': sys.argv
})
client.captureException(extra={
'argv': sys.argv
})
raise

new_execute.__raven_patched = True
Expand Down
25 changes: 1 addition & 24 deletions tests/contrib/django/tests.py
Expand Up @@ -121,7 +121,7 @@ def test_basic(self, captureMessage):


class DjangoClientTest(TestCase):
## Fixture setup/teardown
# Fixture setup/teardown
urls = 'tests.contrib.django.urls'

def setUp(self):
Expand Down Expand Up @@ -601,29 +601,6 @@ def test_without_eager(self, send_raw):
assert send_raw.delay.call_count == 1


class CeleryIntegratedClientTest(TestCase):
def setUp(self):
self.client = CeleryClient()

@mock.patch('raven.contrib.django.celery.send_raw_integrated')
def test_send_encoded(self, send_raw):
with Settings(INSTALLED_APPS=tuple(settings.INSTALLED_APPS) + ('sentry',)):
self.client.send_integrated('foo')

send_raw.delay.assert_called_once_with('foo')

@mock.patch('raven.contrib.django.celery.send_raw_integrated')
def test_without_eager(self, send_raw):
"""
Integration test to ensure it propagates all the way down
and calls delay on the task.
"""
with Settings(INSTALLED_APPS=tuple(settings.INSTALLED_APPS) + ('sentry',)):
self.client.captureMessage(message='test')

assert send_raw.delay.call_count == 1


class IsValidOriginTestCase(TestCase):
def test_setting_empty(self):
with Settings(SENTRY_ALLOW_ORIGIN=None):
Expand Down

0 comments on commit 1deda05

Please sign in to comment.