예제 #1
0
 def on_post(self, req, res):
     validation.validate_authorization(req, ['log_api:logs:post'])
     if CONF.monitoring.enable:
         with self._logs_processing_time.time(name=None):
             self.process_on_post_request(req, res)
     else:
         self.process_on_post_request(req, res)
예제 #2
0
 def on_get(self, req, res, version_id=None):
     validate_authorization(req, ['log_api:versions:get'])
     result = {'links': _get_common_links(req), 'elements': []}
     if version_id is None:
         self.handle_none_version_id(req, res, result)
     else:
         self.handle_version_id(req, res, result, version_id)
예제 #3
0
    def on_get(self, req, res):
        # at this point we know API is alive, so
        # keep up good work and verify kafka status
        validate_authorization(req, ['log_api:healthcheck:get'])
        kafka_result = self._kafka_check.healthcheck()

        # in case it'd be unhealthy,
        # message will contain error string
        status_data = {'kafka': kafka_result.message}

        # Really simple approach, ideally that should be
        # part of monasca-common with some sort of registration of
        # healthchecks concept

        res.status = (self.HEALTHY_CODE_GET
                      if kafka_result.healthy else self.NOT_HEALTHY_CODE)
        res.cache_control = self.CACHE_CONTROL
        res.body = rest_utils.as_json(status_data)
예제 #4
0
 def on_head(self, req, res):
     validate_authorization(req, ['log_api:healthcheck:head'])
     res.status = self.HEALTHY_CODE_HEAD
     res.cache_control = self.CACHE_CONTROL