diff --git a/cloud_platform_azure/__openerp__.py b/cloud_platform_azure/__openerp__.py index 5cfa373..d6c2263 100644 --- a/cloud_platform_azure/__openerp__.py +++ b/cloud_platform_azure/__openerp__.py @@ -12,7 +12,6 @@ "depends": [ "cloud_platform", "attachment_azure", - "monitoring_prometheus", ], "excludes": [ "cloud_platform_ovh", diff --git a/monitoring_prometheus/README.rst b/monitoring_prometheus/README.rst deleted file mode 100644 index aa98ffe..0000000 --- a/monitoring_prometheus/README.rst +++ /dev/null @@ -1,17 +0,0 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License - -============================== -Monitoring: Prometheus metrics -============================== - -Add an endpoint */metrics* to allow a Prometheus server to fetch application metrics. -Current available metrics are: - -* Request completion time with 3 differentiators: - * Filestore - * Assets - * Everything else -* Longpolling request count - -No additional configuration is needed, just ensure that the Prometheus server is allowed to communicate with Odoo diff --git a/monitoring_prometheus/__init__.py b/monitoring_prometheus/__init__.py deleted file mode 100644 index 91c5580..0000000 --- a/monitoring_prometheus/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from . import controllers -from . import models diff --git a/monitoring_prometheus/__openerp__.py b/monitoring_prometheus/__openerp__.py deleted file mode 100644 index 260570c..0000000 --- a/monitoring_prometheus/__openerp__.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2016-2021 Camptocamp SA -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) - - -{ - "name": "Monitoring: Prometheus Metrics", - "version": "15.0.1.0.0", - "author": "Camptocamp,Odoo Community Association (OCA)", - "license": "AGPL-3", - "category": "category", - "depends": [ - "base", - "web", - "server_environment", - ], - "website": "http://www.camptocamp.com", - "data": [], - "external_dependencies": { - "python": ["prometheus_client"], - }, - "installable": True, -} diff --git a/monitoring_prometheus/controllers/__init__.py b/monitoring_prometheus/controllers/__init__.py deleted file mode 100644 index 13ff72f..0000000 --- a/monitoring_prometheus/controllers/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import prometheus_metrics diff --git a/monitoring_prometheus/controllers/prometheus_metrics.py b/monitoring_prometheus/controllers/prometheus_metrics.py deleted file mode 100644 index fae6d36..0000000 --- a/monitoring_prometheus/controllers/prometheus_metrics.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2016-2021 Camptocamp SA -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) - -from openerp.http import Controller, route -from prometheus_client import generate_latest - - -class PrometheusController(Controller): - @route("/metrics", auth="public") - def metrics(self): - return generate_latest() diff --git a/monitoring_prometheus/models/__init__.py b/monitoring_prometheus/models/__init__.py deleted file mode 100644 index 9a5eb71..0000000 --- a/monitoring_prometheus/models/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import ir_http diff --git a/monitoring_prometheus/models/ir_http.py b/monitoring_prometheus/models/ir_http.py deleted file mode 100644 index 67d76ad..0000000 --- a/monitoring_prometheus/models/ir_http.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2016-2021 Camptocamp SA -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) - -from openerp import osv -from openerp.http import request -from prometheus_client import Summary, Counter - - -REQUEST_TIME = Summary( - "request_latency_sec", "Request response time in sec", ["query_type"] -) -LONGPOLLING_COUNT = Counter("longpolling", "Longpolling request count") - - -class IrHttp(osv.osv_abstract): - _inherit = "ir.http" - - @classmethod - def _dispatch(cls): - path_info = request.httprequest.environ.get("PATH_INFO") - - if path_info.startswith("/longpolling/"): - LONGPOLLING_COUNT.inc() - return super(IrHttp, self)._dispatch() - - if path_info.startswith("/metrics"): - return super(IrHttp, self)._dispatch() - - if path_info.startswith("/web/static"): - label = "assets" - elif path_info.startswith("/web/content"): - label = "filestore" - else: - label = "client" - - res = None - with REQUEST_TIME.labels(label).time(): - res = super(IrHttp, self)._dispatch() - - return res