Don't log metrics HTTP data

The metrics endpoint can be scraped frequently and produces a large
response body, hence this turns off logging of this data to prevent
the drowning out of other more salient logging.

Change-Id: I399480726ae39963b010bf5b054ce26d73fb28c5
This commit is contained in:
Sean Eagan 2019-08-21 11:25:20 -05:00
parent 3514d0f3d5
commit 4596e6c0f1
3 changed files with 5 additions and 4 deletions

View File

@ -27,6 +27,7 @@ from armada.handlers.tiller import Tiller
CONF = cfg.CONF
HEALTH_PATH = 'health'
METRICS_PATH = 'metrics'
class BaseResource(object):

View File

@ -18,7 +18,7 @@ from uuid import UUID
from oslo_config import cfg
from oslo_log import log as logging
from armada.api import HEALTH_PATH
from armada.api import HEALTH_PATH, METRICS_PATH
CONF = cfg.CONF
@ -107,7 +107,7 @@ class LoggingMiddleware(object):
hdr_exclude = re.compile('x-.*', re.IGNORECASE)
# don't log anything for health checks
path_exclude = re.compile('.*/{}$'.format(HEALTH_PATH))
path_exclude = re.compile('.*/({}|{})$'.format(HEALTH_PATH, METRICS_PATH))
def exclude_path(self, req):
return LoggingMiddleware.path_exclude.match(req.path)

View File

@ -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, HEALTH_PATH
from armada.api import ArmadaRequest, HEALTH_PATH, METRICS_PATH
from armada.api.controller.armada import Apply
from armada.api.middleware import AuthMiddleware
from armada.api.middleware import ContextMiddleware
@ -69,7 +69,7 @@ def create(enable_middleware=CONF.middleware):
('tests', TestReleasesManifestController()),
('test/{release}', TestReleasesReleaseNameController()),
('validatedesign', Validate()),
('metrics', Metrics()),
(METRICS_PATH, Metrics()),
]
for route, service in url_routes_v1: