Merge "Don't log health checks"
This commit is contained in:
commit
0e76f1bd52
|
@ -27,6 +27,8 @@ from armada.handlers.tiller import Tiller
|
|||
|
||||
CONF = cfg.CONF
|
||||
|
||||
HEALTH_PATH = 'health'
|
||||
|
||||
|
||||
class BaseResource(object):
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
import re
|
||||
|
||||
from armada.api import HEALTH_PATH
|
||||
|
||||
from uuid import UUID
|
||||
|
||||
from oslo_config import cfg
|
||||
|
@ -100,9 +102,18 @@ class LoggingMiddleware(object):
|
|||
# don't log any headers beginning with X-*
|
||||
hdr_exclude = re.compile('x-.*', re.IGNORECASE)
|
||||
|
||||
# don't log anything for health checks
|
||||
path_exclude = re.compile('.*/{}$'.format(HEALTH_PATH))
|
||||
|
||||
def exclude_path(self, req):
|
||||
return LoggingMiddleware.path_exclude.match(req.path)
|
||||
|
||||
def process_request(self, req, resp):
|
||||
""" Set up values to be logged across the request
|
||||
"""
|
||||
if self.exclude_path(req):
|
||||
return
|
||||
|
||||
ctx = req.context
|
||||
extra = {
|
||||
'user': ctx.user,
|
||||
|
@ -115,6 +126,9 @@ class LoggingMiddleware(object):
|
|||
def process_response(self, req, resp, resource, req_succeeded):
|
||||
""" Log the response information
|
||||
"""
|
||||
if self.exclude_path(req):
|
||||
return
|
||||
|
||||
ctx = req.context
|
||||
extra = {
|
||||
'user': ctx.user,
|
||||
|
|
|
@ -18,7 +18,7 @@ from oslo_policy import policy
|
|||
from oslo_log import log as logging
|
||||
|
||||
from armada import conf
|
||||
from armada.api import ArmadaRequest
|
||||
from armada.api import ArmadaRequest, HEALTH_PATH
|
||||
from armada.api.controller.armada import Apply
|
||||
from armada.api.middleware import AuthMiddleware
|
||||
from armada.api.middleware import ContextMiddleware
|
||||
|
@ -60,7 +60,7 @@ def create(enable_middleware=CONF.middleware):
|
|||
|
||||
# Configure API routing
|
||||
url_routes_v1 = (
|
||||
('health', Health()),
|
||||
(HEALTH_PATH, Health()),
|
||||
('apply', Apply()),
|
||||
('releases', Release()),
|
||||
('rollback/{release}', Rollback()),
|
||||
|
|
Loading…
Reference in New Issue