mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 16:48:36 +00:00
[9.0] Filter /monitoring/status werkzeug logs (#68)
* Filter /monitoring/status werkzeug logs With healtchecks, they constitute 95% of our logs. Let's stop wasting resources and shut them up.
This commit is contained in:
committed by
Simone Orsi
co-authored by
Simone Orsi
parent
8332929cb4
commit
cca0ba6bd8
@@ -2,6 +2,7 @@
|
||||
# Copyright 2016 Camptocamp SA
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
import logging
|
||||
import json
|
||||
|
||||
import werkzeug
|
||||
@@ -10,6 +11,21 @@ from openerp import http
|
||||
from openerp.addons.web.controllers.main import ensure_db
|
||||
|
||||
|
||||
class HealthCheckFilter(logging.Filter):
|
||||
|
||||
def __init__(self, path, name=''):
|
||||
super(HealthCheckFilter, self).__init__(name)
|
||||
self.path = path
|
||||
|
||||
def filter(self, record):
|
||||
return self.path not in record.getMessage()
|
||||
|
||||
|
||||
logging.getLogger('werkzeug').addFilter(
|
||||
HealthCheckFilter('"GET /monitoring/status HTTP/1.1"')
|
||||
)
|
||||
|
||||
|
||||
class Monitoring(http.Controller):
|
||||
|
||||
@http.route('/monitoring/status', type='http', auth='none')
|
||||
|
||||
Reference in New Issue
Block a user