Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
 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')
Esempio n. 4
0
 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')
Esempio n. 5
0
    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)
Esempio n. 6
0
    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)
Esempio n. 7
0
 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)
Esempio n. 9
0
 def test_gs_req(self):
     """
     Test if we can parse geoserver requests
     """
     rq = RequestEvent.from_geoserver(self.service, req_big)
     self.assertTrue(rq)
Esempio n. 10
0
 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)
Esempio n. 11
0
 def test_gs_req(self):
     """
     Test if we can parse geoserver requests
     """
     rq = RequestEvent.from_geoserver(self.service, req_big)
     self.assertTrue(rq)
Esempio n. 12
0
 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)