[enh] rewrite and enhance metrics

This commit is contained in:
Alexandre Flament 2021-04-14 17:23:15 +02:00
parent aae7830d14
commit 7acd7ffc02
13 changed files with 427 additions and 210 deletions

View file

@ -10,7 +10,7 @@ from searx import logger
from searx.utils import gen_useragent
from searx.exceptions import (SearxEngineAccessDeniedException, SearxEngineCaptchaException,
SearxEngineTooManyRequestsException,)
from searx.metrology.error_recorder import record_error
from searx.metrics.error_recorder import count_error
from searx.search.processors.abstract import EngineProcessor
@ -90,9 +90,9 @@ class OnlineProcessor(EngineProcessor):
status_code = str(response.status_code or '')
reason = response.reason_phrase or ''
hostname = response.url.host
record_error(self.engine_name,
'{} redirects, maximum: {}'.format(len(response.history), soft_max_redirects),
(status_code, reason, hostname))
count_error(self.engine_name,
'{} redirects, maximum: {}'.format(len(response.history), soft_max_redirects),
(status_code, reason, hostname))
return response