Merge 0726828b6991d67e6a79431a28a68d338824f517 into 150b2e21fdcc06492b7d78bbcb91fbcc037a7831

This commit is contained in:
Alexandre Flament 2025-03-27 10:18:23 +01:00 committed by GitHub
commit 60f4d3a30d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 20 additions and 2 deletions

View File

@ -32,6 +32,10 @@
.engine-reliability {
text-align: right;
}
.engine-request-count {
text-align: right;
}
}
table.engine-error th.engine-error-type,

View File

@ -92,6 +92,9 @@ def initialize(engine_names=None, enabled=True):
histogram_width = 0.1
histogram_size = int(1.5 * max_timeout / histogram_width)
# global
counter_storage.configure('search', 'count', 'sent')
# engines
for engine_name in engine_names or engines:
# search count
@ -209,6 +212,7 @@ def get_engines_stats(engine_name_list):
'score': 0,
'score_per_result': 0,
'result_count': result_count,
'request_count': sent_count,
}
if successful_count and result_count_sum:
@ -244,6 +248,11 @@ def get_engines_stats(engine_name_list):
list_time.append(stats)
# request_count (per engine) is a percentage of the total number of requests
total_request_count = counter('search', 'count', 'sent')
for stats in list_time:
stats['request_count'] = int(round(stats['request_count'] * 100 / total_request_count, 0))
return {
'time': list_time,
'max_time': math.ceil(max_time_total or 0),

View File

@ -83,6 +83,8 @@ class Search:
# max of all selected engine timeout
default_timeout = 0
counter_inc('search', 'count', 'sent')
# start search-request for all selected engines
for engineref in self.search_query.engineref_list:
processor = PROCESSORS[engineref.name]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,7 @@
<th scope="col" class="result-count">{{ th_sort('result_count', _('Result count')) }}</th>
<th scope="col" class="response-time">{{ th_sort('time', _('Response time')) }}</th>
<th scope="col" class="engine-reliability">{{ th_sort('reliability', _('Reliability')) }}</th>
<th scope="col" class="engine-request-count">{{ th_sort('request', _('Request count')) }}</th>
</tr>
{% for engine_stat in engine_stats.get('time', []) %}
<tr>
@ -83,6 +84,7 @@
{%- endif -%}
</td>
<td class="engine-reliability"> {{ engine_reliabilities.get(engine_stat.name, {}).get('reliability') }}</td>
<td class="engine-request-count"> {{ engine_stat.request_count }}</td>
</tr>
{% endfor %}
</table>

View File

@ -150,6 +150,7 @@ STATS_SORT_PARAMETERS = {
'result_count': (True, 'result_count', 0),
'time': (False, 'total', 0),
'reliability': (False, 'reliability', 100),
'request': (True, 'request_count', 0),
}
# Flask app