From 387c4ef9745c032a1ac2cce10746ad53633afb86 Mon Sep 17 00:00:00 2001 From: Giovanni Barillari Date: Wed, 19 Apr 2023 16:07:33 +0200 Subject: [PATCH] Fix pipes injection with metrics disabled --- emmett_prometheus/__version__.py | 2 +- emmett_prometheus/ext.py | 4 ++-- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/emmett_prometheus/__version__.py b/emmett_prometheus/__version__.py index 3dc1f76..485f44a 100644 --- a/emmett_prometheus/__version__.py +++ b/emmett_prometheus/__version__.py @@ -1 +1 @@ -__version__ = "0.1.0" +__version__ = "0.1.1" diff --git a/emmett_prometheus/ext.py b/emmett_prometheus/ext.py index 2b253f1..17edd85 100644 --- a/emmett_prometheus/ext.py +++ b/emmett_prometheus/ext.py @@ -89,9 +89,9 @@ def _inject_pipes(self, route, f): return if f == self._metrics_route: return - if isinstance(route, HTTPRoutingRule): + if self.config.enable_http_metrics and isinstance(route, HTTPRoutingRule): route.pipeline.insert(0, self._pipe_http) - if isinstance(route, WebsocketRoutingRule): + if self.config.enable_ws_metrics and isinstance(route, WebsocketRoutingRule): route.pipeline.insert(0, self._pipe_ws) async def _metrics_route(self): diff --git a/pyproject.toml b/pyproject.toml index 4106c11..77c4eb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "emmett-prometheus" -version = "0.1.0" +version = "0.1.1" description = "Prometheus extension for Emmett framework" authors = ["Giovanni Barillari "] license = "BSD-3-Clause"