summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-01-17 16:11:26 +0100
committerAlexandre Flament <alex@al-f.net>2021-01-17 16:25:11 +0100
commitca76f3119a4d66cb8aa74829ca5f0a0a72f0f96b (patch)
treee4d0d789f723bac1ede7ed4b30a97acd17649342 /searx
parent80d7411f2cf72b0ba7b72afe85a6703db5ec3525 (diff)
downloadsearxng-ca76f3119a4d66cb8aa74829ca5f0a0a72f0f96b.tar.gz
searxng-ca76f3119a4d66cb8aa74829ca5f0a0a72f0f96b.zip
[fix] error_recorder: record code and lineno about the engine
since the PR #2225 , code and lineno were sometimes meaningless see /stats/errors
Diffstat (limited to 'searx')
-rw-r--r--searx/metrology/error_recorder.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/searx/metrology/error_recorder.py b/searx/metrology/error_recorder.py
index 65dbf33c8..bd8404ad1 100644
--- a/searx/metrology/error_recorder.py
+++ b/searx/metrology/error_recorder.py
@@ -51,15 +51,12 @@ def add_error_context(engine_name: str, error_context: ErrorContext) -> None:
def get_trace(traces):
- previous_trace = traces[-1]
for trace in reversed(traces):
- if trace.filename.endswith('searx/search.py'):
- if previous_trace.filename.endswith('searx/poolrequests.py'):
- return trace
- if previous_trace.filename.endswith('requests/models.py'):
- return trace
- return previous_trace
- previous_trace = trace
+ split_filename = trace.filename.split('/')
+ if len(split_filename) > 3 and '/'.join(split_filename[-3:-1]) == 'searx/engines':
+ return trace
+ if len(split_filename) > 3 and '/'.join(split_filename[-4:-1]) == 'searx/search/processors':
+ return trace
return traces[-1]