Remove Sentry integrated client

This commit is contained in:
David Cramer 2015-03-29 11:37:51 -07:00
parent 4899aa0d88
commit 1deda056ce
5 changed files with 7 additions and 63 deletions

View File

@ -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
-------------

View File

@ -92,9 +92,7 @@ class ClientState(object):
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.

View File

@ -27,9 +27,6 @@ __all__ = ('DjangoClient',)
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}
@ -167,27 +164,3 @@ class DjangoClient(Client):
}
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)

View File

@ -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

View File

@ -121,7 +121,7 @@ class ClientProxyTest(TestCase):
class DjangoClientTest(TestCase):
## Fixture setup/teardown
# Fixture setup/teardown
urls = 'tests.contrib.django.urls'
def setUp(self):
@ -601,29 +601,6 @@ class CeleryIsolatedClientTest(TestCase):
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):