def run(self): q = RequestToMonitoringThread.q while True: if not q.empty(): item = q.get() req, resp = item RequestEvent.from_geonode(self.service, req, resp)
def test_gs_err_req(self): """ Test if we can parse geoserver requests """ rq = RequestEvent.from_geoserver(self.service, req_err_big) self.assertTrue(rq) q = ExceptionEvent.objects.filter(request=rq) self.assertEqual(q.count(), 1) self.assertEqual(q[0].error_type, 'org.geoserver.platform.ServiceException')
def test_gs_err_req(self): """ Test if we can parse geoserver requests """ rq = RequestEvent.from_geoserver(self.service, req_err_big) self.assertTrue(rq) q = ExceptionEvent.objects.filter(request=rq) self.assertEqual(q.count(), 1) self.assertEqual( q[0].error_type, 'org.geoserver.platform.ServiceException')
def emit(self, record): exc_info = record.exc_info req = record.request resp = record.response if not req._monitoring.get('processed'): re = RequestEvent.from_geonode(self.service, req, resp) req._monitoring['processed'] = re re = req._monitoring.get('processed') if exc_info: tb = traceback.format_exception(*exc_info) ExceptionEvent.add_error(self.service, exc_info[1], tb, request=re)
def handle_collected(self, requests): utc = pytz.utc now = datetime.utcnow().replace(tzinfo=utc) for r in requests: RequestEvent.from_geoserver(self.service, r, received=now) return RequestEvent.objects.filter(service=self.service, received=now)
def handle_collected(self, requests): now = datetime.now() for r in requests: RequestEvent.from_geoserver(self.service, r, received=now) return RequestEvent.objects.filter(service=self.service, received=now)
def test_gs_req(self): """ Test if we can parse geoserver requests """ rq = RequestEvent.from_geoserver(self.service, req_big) self.assertTrue(rq)