From 1539e0576118a779f42da33c6931154140e2ad27 Mon Sep 17 00:00:00 2001 From: Alberto Vara Date: Sat, 25 May 2024 17:01:34 +0200 Subject: [PATCH] fix: update versions and fix minor bugs --- pylintrc | 9 ++------- pyms/flask/services/metrics.py | 2 +- pyms/flask/services/tracer.py | 13 ++++++------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/pylintrc b/pylintrc index 9f285fd..7fb1009 100644 --- a/pylintrc +++ b/pylintrc @@ -55,7 +55,8 @@ confidence= # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" disable=logging-format-interpolation,broad-except,unnecessary-pass,no-member,line-too-long,invalid-name, - missing-module-docstring,missing-class-docstring,missing-function-docstring,too-few-public-methods + missing-module-docstring,missing-class-docstring,missing-function-docstring,too-few-public-methods, + consider-using-f-string,deprecated-class,unnecessary-dunder-call,deprecated-module # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option @@ -256,12 +257,6 @@ max-line-length=120 # Maximum number of lines in a module max-module-lines=1000 -# List of optional constructs for which whitespace checking is disabled. `dict- -# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. -# `trailing-comma` allows a space between comma and closing bracket: (a, ). -# `empty-line` allows space-only lines. -no-space-check=trailing-comma, - dict-separator # Allow the body of a class to be on the same line as the declaration if body # contains single statement. diff --git a/pyms/flask/services/metrics.py b/pyms/flask/services/metrics.py index d314bad..86642b2 100644 --- a/pyms/flask/services/metrics.py +++ b/pyms/flask/services/metrics.py @@ -31,7 +31,7 @@ class FlaskMetricsWrapper: def __init__(self, app_name): self.app_name = app_name - def before_request(self) -> None: # pylint: disable=R0201 + def before_request(self) -> None: request.start_time = time.time() # pylint: disable=assigning-non-slot def after_request(self, response: Response) -> Response: diff --git a/pyms/flask/services/tracer.py b/pyms/flask/services/tracer.py index d68f84a..1a39cf9 100644 --- a/pyms/flask/services/tracer.py +++ b/pyms/flask/services/tracer.py @@ -3,9 +3,8 @@ from flask import current_app, has_request_context, request -from pyms.config.conf import get_conf from pyms.constants import LOGGER_NAME -from pyms.flask.services.driver import DriverService, get_service_name +from pyms.flask.services.driver import DriverService from pyms.utils import check_package_exists, import_from, import_package opentracing = None @@ -32,7 +31,7 @@ def inject_span_in_headers(headers: dict) -> dict: if tracer: span = tracer.get_span(request=request) if not span: # pragma: no cover - span = get_current_span() + span = get_current_span if not span: span = tracer.tracer.start_span() context = span.context if span else None @@ -78,11 +77,11 @@ def init_jaeger_tracer(self): host = {} if self.host: host = {"local_agent": {"reporting_host": self.host}} - metrics_config = get_conf(service=get_service_name(service="metrics"), empty_init=True) + # metrics_config = get_conf(service=get_service_name(service="metrics"), empty_init=True) metrics = "" - if metrics_config: - service_name = self.component_name.lower().replace("-", "_").replace(" ", "_") - metrics = PrometheusMetricsFactory(service_name_label=service_name) + # if metrics_config: + # service_name = self.component_name.lower().replace("-", "_").replace(" ", "_") + # metrics = PrometheusMetricsFactory(service_name_label=service_name) config = Config( config={ **{