mirror of
https://github.com/searxng/searxng.git
synced 2024-11-29 22:21:02 +00:00
[mod] searx.metrics.error_recorder: store relative file name instead of the full absolute file name.
This commit is contained in:
parent
9b482e8fcc
commit
b8f5adf500
2 changed files with 4 additions and 1 deletions
|
@ -22,6 +22,7 @@ from os.path import realpath, dirname, join, abspath, isfile
|
||||||
|
|
||||||
|
|
||||||
searx_dir = abspath(dirname(__file__))
|
searx_dir = abspath(dirname(__file__))
|
||||||
|
searx_parent_dir = abspath(dirname(dirname(__file__)))
|
||||||
engine_dir = dirname(realpath(__file__))
|
engine_dir = dirname(realpath(__file__))
|
||||||
static_path = abspath(join(dirname(__file__), 'static'))
|
static_path = abspath(join(dirname(__file__), 'static'))
|
||||||
settings, settings_load_message = searx.settings_loader.load_settings()
|
settings, settings_load_message = searx.settings_loader.load_settings()
|
||||||
|
|
|
@ -5,7 +5,7 @@ from urllib.parse import urlparse
|
||||||
from httpx import HTTPError, HTTPStatusError
|
from httpx import HTTPError, HTTPStatusError
|
||||||
from searx.exceptions import (SearxXPathSyntaxException, SearxEngineXPathException, SearxEngineAPIException,
|
from searx.exceptions import (SearxXPathSyntaxException, SearxEngineXPathException, SearxEngineAPIException,
|
||||||
SearxEngineAccessDeniedException)
|
SearxEngineAccessDeniedException)
|
||||||
from searx import logger
|
from searx import logger, searx_parent_dir
|
||||||
|
|
||||||
|
|
||||||
errors_per_engines = {}
|
errors_per_engines = {}
|
||||||
|
@ -117,6 +117,8 @@ def get_exception_classname(exc: Exception) -> str:
|
||||||
def get_error_context(framerecords, exception_classname, log_message, log_parameters, secondary) -> ErrorContext:
|
def get_error_context(framerecords, exception_classname, log_message, log_parameters, secondary) -> ErrorContext:
|
||||||
searx_frame = get_trace(framerecords)
|
searx_frame = get_trace(framerecords)
|
||||||
filename = searx_frame.filename
|
filename = searx_frame.filename
|
||||||
|
if filename.startswith(searx_parent_dir):
|
||||||
|
filename = filename[len(searx_parent_dir) + 1:]
|
||||||
function = searx_frame.function
|
function = searx_frame.function
|
||||||
line_no = searx_frame.lineno
|
line_no = searx_frame.lineno
|
||||||
code = searx_frame.code_context[0].strip()
|
code = searx_frame.code_context[0].strip()
|
||||||
|
|
Loading…
Reference in a new issue