This commit is contained in:
Alexandre Flament 2024-02-25 03:33:10 -07:00 committed by GitHub
commit 2087ff4aa6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 23 additions and 5 deletions

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
@ -206,6 +209,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:
@ -241,6 +245,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

@ -89,6 +89,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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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

@ -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

@ -155,6 +155,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

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: AGPL-3.0-or-later
export NODE_MINIMUM_VERSION="16.13.0"
export NODE_MINIMUM_VERSION="18.17.0"
node.help(){
cat <<EOF