mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-23 18:04:34 +00:00
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:
@@ -1,2 +1 @@
|
|||||||
|
|
||||||
from . import controllers
|
from . import controllers
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Copyright 2016-2018 Camptocamp SA
|
# Copyright 2016-2018 Camptocamp SA
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
|
import logging
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import werkzeug
|
import werkzeug
|
||||||
@@ -9,6 +10,21 @@ from odoo import http
|
|||||||
from odoo.addons.web.controllers.main import ensure_db
|
from odoo.addons.web.controllers.main import ensure_db
|
||||||
|
|
||||||
|
|
||||||
|
class HealthCheckFilter(logging.Filter):
|
||||||
|
|
||||||
|
def __init__(self, path, name=''):
|
||||||
|
super().__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):
|
class Monitoring(http.Controller):
|
||||||
|
|
||||||
@http.route('/monitoring/status', type='http', auth='none')
|
@http.route('/monitoring/status', type='http', auth='none')
|
||||||
|
|||||||
Reference in New Issue
Block a user