예제 #1
0
 def test_basic(self):
     config = {
         'APP_ID': 'key',
         'ORGANIZATION_ID': 'org',
         'SECRET_TOKEN': '99'
     }
     config.update(settings.OPBEAT)
     event_count = len(client.events)
     with self.settings(OPBEAT=config):
         client.capture('Message', message='foo')
         self.assertEquals(len(client.events), event_count + 1)
         client.events.pop(0)
예제 #2
0
 def process_response(self, request, response):
     if (response.status_code != 404 or
             _is_ignorable_404(request.get_full_path())):
         return response
     if disabled_due_to_debug(
                 getattr(django_settings, 'OPBEAT', {}),
                 django_settings.DEBUG
             ):
         return response
     data = client.get_data_from_request(request)
     data.update({
         'level': logging.INFO,
         'logger': 'http404',
     })
     result = client.capture(
         'Message',
         param_message={
             'message': 'Page Not Found: %s',
             'params': [request.build_absolute_uri()]
         }, data=data
     )
     request.opbeat = {
         'app_id': data.get('app_id', client.app_id),
         'id': client.get_ident(result),
     }
     return response
예제 #3
0
 def process_response(self, request, response):
     if response.status_code != 404 or _is_ignorable_404(
             request.get_full_path()):
         return response
     data = client.get_data_from_request(request)
     data.update({
         'level': logging.INFO,
         'logger': 'http404',
     })
     result = client.capture('Message',
                             param_message={
                                 'message': 'Page Not Found: %s',
                                 'params': [request.build_absolute_uri()]
                             },
                             data=data)
     request.opbeat = {
         'app_id': data.get('app_id', client.app_id),
         'id': client.get_ident(result),
     }
     return response