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