Compare commits

...

5 Commits

Author SHA1 Message Date
Bnyro 890db29f9f
Merge 443fcc7233 into b8f1a329d3 2024-11-22 13:12:44 +01:00
searxng-bot b8f1a329d3 [l10n] update translations from Weblate
6581d89b3 - 2024-11-21 - return42 <return42@users.noreply.translate.codeberg.org>
a342903eb - 2024-11-21 - return42 <return42@users.noreply.translate.codeberg.org>
61d3236b9 - 2024-11-21 - return42 <return42@users.noreply.translate.codeberg.org>
cd03e8cc5 - 2024-11-21 - return42 <return42@users.noreply.translate.codeberg.org>
a2399e23a - 2024-11-20 - tentsbet <tentsbet@users.noreply.translate.codeberg.org>
9a5bcc06d - 2024-11-17 - cherrad <cherrad@users.noreply.translate.codeberg.org>
4364e5ef8 - 2024-11-16 - DiamondBrain113 <DiamondBrain113@users.noreply.translate.codeberg.org>
e3a127ec8 - 2024-11-15 - KinoCineaste <KinoCineaste@users.noreply.translate.codeberg.org>
2024-11-22 10:02:42 +01:00
dependabot[bot] 67f7548573 [upd] pypi: Bump typer-slim from 0.13.0 to 0.13.1
Bumps [typer-slim](https://github.com/fastapi/typer) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/fastapi/typer/releases)
- [Changelog](https://github.com/fastapi/typer/blob/master/docs/release-notes.md)
- [Commits](https://github.com/fastapi/typer/compare/0.13.0...0.13.1)

---
updated-dependencies:
- dependency-name: typer-slim
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-22 09:59:26 +01:00
dependabot[bot] f40fc2dd4f [upd] pypi: Bump setproctitle from 1.3.3 to 1.3.4
Bumps [setproctitle](https://github.com/dvarrazzo/py-setproctitle) from 1.3.3 to 1.3.4.
- [Changelog](https://github.com/dvarrazzo/py-setproctitle/blob/master/HISTORY.rst)
- [Commits](https://github.com/dvarrazzo/py-setproctitle/compare/version-1.3.3...version-1.3.4)

---
updated-dependencies:
- dependency-name: setproctitle
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-22 09:58:19 +01:00
Bnyro 443fcc7233 [feat] metrics: support for open metrics 2024-10-15 11:34:17 +02:00
22 changed files with 210 additions and 105 deletions

View File

@ -11,11 +11,11 @@ httpx[http2]==0.24.1
Brotli==1.1.0
uvloop==0.21.0
httpx-socks[asyncio]==0.7.7
setproctitle==1.3.3
setproctitle==1.3.4
redis==5.0.8
markdown-it-py==3.0.0
fasttext-predict==0.9.2.2
tomli==2.0.2; python_version < '3.11'
msgspec==0.18.6
eval_type_backport; python_version < '3.9'
typer-slim==0.13.0
typer-slim==0.13.1

View File

@ -8,6 +8,7 @@ from timeit import default_timer
from operator import itemgetter
from searx.engines import engines
from searx.openmetrics import OpenMetricsFamily
from .models import HistogramStorage, CounterStorage, VoidHistogram, VoidCounterStorage
from .error_recorder import count_error, count_exception, errors_per_engines
@ -149,7 +150,9 @@ def get_reliabilities(engline_name_list, checker_results):
checker_result = checker_results.get(engine_name, {})
checker_success = checker_result.get('success', True)
errors = engine_errors.get(engine_name) or []
if counter('engine', engine_name, 'search', 'count', 'sent') == 0:
sent_count = counter('engine', engine_name, 'search', 'count', 'sent')
if sent_count == 0:
# no request
reliability = None
elif checker_success and not errors:
@ -164,8 +167,9 @@ def get_reliabilities(engline_name_list, checker_results):
reliabilities[engine_name] = {
'reliability': reliability,
'sent_count': sent_count,
'errors': errors,
'checker': checker_results.get(engine_name, {}).get('errors', {}),
'checker': checker_result.get('errors', {}),
}
return reliabilities
@ -245,3 +249,53 @@ def get_engines_stats(engine_name_list):
'max_time': math.ceil(max_time_total or 0),
'max_result_count': math.ceil(max_result_count or 0),
}
def openmetrics(engine_stats, engine_reliabilities):
metrics = [
OpenMetricsFamily(
key="searxng_engines_response_time_total_seconds",
type_hint="gauge",
help_hint="The average total response time of the engine",
data_info=[{'engine_name': engine['name']} for engine in engine_stats['time']],
data=[engine['total'] for engine in engine_stats['time']],
),
OpenMetricsFamily(
key="searxng_engines_response_time_processing_seconds",
type_hint="gauge",
help_hint="The average processing response time of the engine",
data_info=[{'engine_name': engine['name']} for engine in engine_stats['time']],
data=[engine['processing'] for engine in engine_stats['time']],
),
OpenMetricsFamily(
key="searxng_engines_response_time_http_seconds",
type_hint="gauge",
help_hint="The average HTTP response time of the engine",
data_info=[{'engine_name': engine['name']} for engine in engine_stats['time']],
data=[engine['http'] for engine in engine_stats['time']],
),
OpenMetricsFamily(
key="searxng_engines_result_count_total",
type_hint="counter",
help_hint="The total amount of results returned by the engine",
data_info=[{'engine_name': engine['name']} for engine in engine_stats['time']],
data=[engine['result_count'] for engine in engine_stats['time']],
),
OpenMetricsFamily(
key="searxng_engines_request_count_total",
type_hint="counter",
help_hint="The total amount of user requests made to this engine",
data_info=[{'engine_name': engine['name']} for engine in engine_stats['time']],
data=[engine_reliabilities.get(engine['name'], {}).get('sent_count', 0) for engine in engine_stats['time']],
),
OpenMetricsFamily(
key="searxng_engines_reliability_total",
type_hint="counter",
help_hint="The overall reliability of the engine",
data_info=[{'engine_name': engine['name']} for engine in engine_stats['time']],
data=[
engine_reliabilities.get(engine['name'], {}).get('reliability', 0) for engine in engine_stats['time']
],
),
]
return "".join([str(metric) for metric in metrics])

35
searx/openmetrics.py Normal file
View File

@ -0,0 +1,35 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Module providing support for displaying data in OpenMetrics format"""
class OpenMetricsFamily: # pylint: disable=too-few-public-methods
"""A family of metrics.
The key parameter is the metric name that should be used (snake case).
The type_hint parameter must be one of 'counter', 'gauge', 'histogram', 'summary'.
The help_hint parameter is a short string explaining the metric.
The data_info parameter is a dictionary of descriptionary parameters for the data point (e.g. request method/path).
The data parameter is a flat list of the actual data in shape of a primive type.
See https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md for more information.
"""
def __init__(self, key: str, type_hint: str, help_hint: str, data_info: list, data: list):
self.key = key
self.type_hint = type_hint
self.help_hint = help_hint
self.data_info = data_info
self.data = data
def __str__(self):
text_representation = f"""# HELP {self.key} {self.help_hint}
# TYPE {self.key} {self.type_hint}
"""
for i in range(0, len(self.data_info)):
if not self.data[i] and self.data[i] != 0:
continue
info_representation = ','.join([f"{key}=\"{value}\"" for (key, value) in self.data_info[i].items()])
text_representation += f"{self.key}{{{info_representation}}} {self.data[i]}\n"
return text_representation

View File

@ -12,6 +12,10 @@ general:
contact_url: false
# record stats
enable_metrics: true
# expose stats in open metrics format at /metrics
# leave empty to disable (no password set)
# open_metrics: <password>
open_metrics: ''
brand:
new_issue_url: https://github.com/searxng/searxng/issues/new

View File

@ -143,6 +143,7 @@ SCHEMA = {
'contact_url': SettingsValue((None, False, str), None),
'donation_url': SettingsValue((bool, str), "https://docs.searxng.org/donate.html"),
'enable_metrics': SettingsValue(bool, True),
'open_metrics': SettingsValue(str, ''),
},
'brand': {
'issue_url': SettingsValue(str, 'https://github.com/searxng/searxng/issues'),

View File

@ -18,22 +18,23 @@
# Yahya-Lando <Yahya-Lando@users.noreply.translate.codeberg.org>, 2024.
# nebras <nebras@users.noreply.translate.codeberg.org>, 2024.
# geekom13 <geekom13@users.noreply.translate.codeberg.org>, 2024.
# cherrad <cherrad@users.noreply.translate.codeberg.org>, 2024.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-10-04 07:09+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>"
"\n"
"PO-Revision-Date: 2024-11-17 23:56+0000\n"
"Last-Translator: cherrad <cherrad@users.noreply.translate.codeberg.org>\n"
"Language-Team: Arabic <https://translate.codeberg.org/projects/searxng/"
"searxng/ar/>\n"
"Language: ar\n"
"Language-Team: Arabic "
"<https://translate.codeberg.org/projects/searxng/searxng/ar/>\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : "
"n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -461,7 +462,7 @@ msgstr "حوسبة معطيات ال{functions}"
#: searx/engines/mozhi.py:57
msgid "Synonyms"
msgstr ""
msgstr "مرادفات"
#: searx/engines/openstreetmap.py:159
msgid "Get directions"
@ -1224,11 +1225,11 @@ msgstr "أقصى مدّة"
#: searx/templates/simple/preferences/favicon.html:2
msgid "Favicon Resolver"
msgstr ""
msgstr "محلل أيقونة المفضلة"
#: searx/templates/simple/preferences/favicon.html:15
msgid "Display favicons near search results"
msgstr ""
msgstr "عرض المفضلات قرب نتائج البحث"
#: searx/templates/simple/preferences/footer.html:2
msgid ""
@ -1973,4 +1974,3 @@ msgstr "إخفاء الفيديو"
#~ msgid "Engines cannot retrieve results"
#~ msgstr "لم تتمكن محركات البحث من العثور على أية نتيجة"

View File

@ -18,9 +18,8 @@ msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-10-13 03:30+0000\n"
"Last-Translator: stoychevww <stoychevww@users.noreply.translate.codeberg.org>"
"\n"
"PO-Revision-Date: 2024-11-21 08:13+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
"Language-Team: Bulgarian <https://translate.codeberg.org/projects/searxng/"
"searxng/bg/>\n"
"Language: bg\n"
@ -28,7 +27,7 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.7.2\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -59,7 +58,7 @@ msgstr "музика"
#. CATEGORY_NAMES['SOCIAL_MEDIA']
#: searx/searxng.msg
msgid "social media"
msgstr "социална мрежа"
msgstr "социална медия"
#. CATEGORY_NAMES['IMAGES']
#: searx/searxng.msg
@ -159,12 +158,12 @@ msgstr "автоматичен"
#. STYLE_NAMES['LIGHT']
#: searx/searxng.msg
msgid "light"
msgstr "светъл"
msgstr "светло"
#. STYLE_NAMES['DARK']
#: searx/searxng.msg
msgid "dark"
msgstr "тъмен"
msgstr "тъмно"
#. STYLE_NAMES['BLACK']
#: searx/searxng.msg
@ -364,7 +363,7 @@ msgstr "Грешка при зареждането на следващата с
#: searx/webapp.py:495 searx/webapp.py:898
msgid "Invalid settings, please edit your preferences"
msgstr "Неправилни настройки, моля проверете предпочитанията си"
msgstr "Неправилни настройки, моля редактирайте предпочитанията си"
#: searx/webapp.py:511
msgid "Invalid settings"
@ -412,11 +411,11 @@ msgstr "прокси грешка"
#: searx/webutils.py:57
msgid "CAPTCHA"
msgstr "Кепча"
msgstr "CAPTCHA"
#: searx/webutils.py:58
msgid "too many requests"
msgstr "твърде много искания"
msgstr "твърде много повиквания"
#: searx/webutils.py:59
msgid "access denied"
@ -520,7 +519,7 @@ msgstr ""
#: searx/engines/tineye.py:57
msgid "The image could not be downloaded."
msgstr "Снимката не може да бъде смъкната."
msgstr "Снимката не може да бъде свалена."
#: searx/engines/zlibrary.py:138
msgid "Book rating"

View File

@ -13,21 +13,23 @@
# RTRedreovic <RTRedreovic@users.noreply.translate.codeberg.org>, 2023.
# Azharjan <alexander.um.edu@gmail.com>, 2023.
# return42 <return42@users.noreply.translate.codeberg.org>, 2024.
# KinoCineaste <KinoCineaste@users.noreply.translate.codeberg.org>, 2024.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-09-05 06:18+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>"
"\n"
"PO-Revision-Date: 2024-11-16 08:04+0000\n"
"Last-Translator: KinoCineaste <KinoCineaste@users.noreply.translate.codeberg."
"org>\n"
"Language-Team: Esperanto <https://translate.codeberg.org/projects/searxng/"
"searxng/eo/>\n"
"Language: eo\n"
"Language-Team: Esperanto "
"<https://translate.codeberg.org/projects/searxng/searxng/eo/>\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -78,7 +80,7 @@ msgstr "radio"
#. CATEGORY_NAMES['TV']
#: searx/searxng.msg
msgid "tv"
msgstr ""
msgstr "televido"
#. CATEGORY_NAMES['IT']
#: searx/searxng.msg
@ -168,7 +170,7 @@ msgstr "malhela"
#. STYLE_NAMES['BLACK']
#: searx/searxng.msg
msgid "black"
msgstr ""
msgstr "nigra"
#. BRAND_CUSTOM_LINKS['UPTIME']
#: searx/searxng.msg
@ -1961,4 +1963,3 @@ msgstr "kaŝi videojn"
#~ msgid "Engines cannot retrieve results"
#~ msgstr "Serĉiloj ne povas retrovi rezultojn"

View File

@ -26,16 +26,16 @@ msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-09-23 01:18+0000\n"
"Last-Translator: tentsbet <tentsbet@users.noreply.translate.codeberg.org>"
"\n"
"PO-Revision-Date: 2024-11-21 05:07+0000\n"
"Last-Translator: tentsbet <tentsbet@users.noreply.translate.codeberg.org>\n"
"Language-Team: Japanese <https://translate.codeberg.org/projects/searxng/"
"searxng/ja/>\n"
"Language: ja\n"
"Language-Team: Japanese "
"<https://translate.codeberg.org/projects/searxng/searxng/ja/>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -176,7 +176,7 @@ msgstr "ダーク"
#. STYLE_NAMES['BLACK']
#: searx/searxng.msg
msgid "black"
msgstr ""
msgstr "ブラック"
#. BRAND_CUSTOM_LINKS['UPTIME']
#: searx/searxng.msg
@ -463,7 +463,7 @@ msgstr "変数の {functions} を計算する"
#: searx/engines/mozhi.py:57
msgid "Synonyms"
msgstr ""
msgstr "類義語"
#: searx/engines/openstreetmap.py:159
msgid "Get directions"
@ -1202,11 +1202,11 @@ msgstr "最大時間"
#: searx/templates/simple/preferences/favicon.html:2
msgid "Favicon Resolver"
msgstr ""
msgstr "Favicon Resolver"
#: searx/templates/simple/preferences/favicon.html:15
msgid "Display favicons near search results"
msgstr ""
msgstr "検索結果でfaviconに合いそうなものを表示する"
#: searx/templates/simple/preferences/footer.html:2
msgid ""
@ -1917,4 +1917,3 @@ msgstr "動画を隠す"
#~ msgid "Engines cannot retrieve results"
#~ msgstr "エンジンは結果を取得できません"

View File

@ -16,16 +16,16 @@ msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-07-19 07:09+0000\n"
"Last-Translator: wazhanudin "
"<wazhanudin@users.noreply.translate.codeberg.org>\n"
"PO-Revision-Date: 2024-11-21 08:13+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
"Language-Team: Malay <https://translate.codeberg.org/projects/searxng/"
"searxng/ms/>\n"
"Language: ms\n"
"Language-Team: Malay "
"<https://translate.codeberg.org/projects/searxng/searxng/ms/>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -166,7 +166,7 @@ msgstr "gelap"
#. STYLE_NAMES['BLACK']
#: searx/searxng.msg
msgid "black"
msgstr ""
msgstr "Hitam"
#. BRAND_CUSTOM_LINKS['UPTIME']
#: searx/searxng.msg
@ -1690,4 +1690,3 @@ msgstr "sembunyikkan video"
#~ msgid "Engines cannot retrieve results"
#~ msgstr "Enjin tidak dapat mendapatkan keputusan"

View File

@ -21,17 +21,17 @@ msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-09-28 15:23+0000\n"
"Last-Translator: UnD37970UnD "
"<UnD37970UnD@users.noreply.translate.codeberg.org>\n"
"PO-Revision-Date: 2024-11-21 08:13+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
"Language-Team: Romanian <https://translate.codeberg.org/projects/searxng/"
"searxng/ro/>\n"
"Language: ro\n"
"Language-Team: Romanian "
"<https://translate.codeberg.org/projects/searxng/searxng/ro/>\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 "
"< 20)) ? 1 : 2;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < "
"20)) ? 1 : 2;\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -172,7 +172,7 @@ msgstr "întunecat"
#. STYLE_NAMES['BLACK']
#: searx/searxng.msg
msgid "black"
msgstr ""
msgstr "negru"
#. BRAND_CUSTOM_LINKS['UPTIME']
#: searx/searxng.msg
@ -1998,4 +1998,3 @@ msgstr "ascunde video"
#~ msgid "Engines cannot retrieve results"
#~ msgstr "Motoarele nu pot obține rezultate"

View File

@ -16,17 +16,17 @@ msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-09-05 06:18+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>"
"\n"
"PO-Revision-Date: 2024-11-21 08:13+0000\n"
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
"Language-Team: Serbian <https://translate.codeberg.org/projects/searxng/"
"searxng/sr/>\n"
"Language: sr\n"
"Language-Team: Serbian "
"<https://translate.codeberg.org/projects/searxng/searxng/sr/>\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 5.8.1\n"
"Generated-By: Babel 2.16.0\n"
#. CONSTANT_NAMES['NO_SUBGROUPING']
@ -252,7 +252,7 @@ msgstr "Подне"
#. WEATHER_TERMS['PRESSURE']
#: searx/engines/open_meteo.py:95 searx/searxng.msg
msgid "Pressure"
msgstr ""
msgstr "Притисак"
#. WEATHER_TERMS['SUNRISE']
#: searx/engines/duckduckgo_weather.py:81 searx/engines/wttr.py:36
@ -1972,4 +1972,3 @@ msgstr "сакриј видео"
#~ msgid "Engines cannot retrieve results"
#~ msgstr "Не може повратити резултате"

View File

@ -11,13 +11,15 @@
# vducong <vducong@users.noreply.translate.codeberg.org>, 2024.
# tvminh19 <tvminh19@users.noreply.translate.codeberg.org>, 2024.
# KhietVo <KhietVo@users.noreply.translate.codeberg.org>, 2024.
# DiamondBrain113 <DiamondBrain113@users.noreply.translate.codeberg.org>, 2024.
msgid ""
msgstr ""
"Project-Id-Version: searx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
"PO-Revision-Date: 2024-11-14 14:07+0000\n"
"Last-Translator: KhietVo <KhietVo@users.noreply.translate.codeberg.org>\n"
"PO-Revision-Date: 2024-11-16 20:44+0000\n"
"Last-Translator: DiamondBrain113 <DiamondBrain113@users.noreply.translate."
"codeberg.org>\n"
"Language-Team: Vietnamese <https://translate.codeberg.org/projects/searxng/"
"searxng/vi/>\n"
"Language: vi\n"
@ -299,13 +301,13 @@ msgstr "những bài đăng"
#. SOCIAL_MEDIA_TERMS['ACTIVE USERS']
#: searx/engines/lemmy.py:87 searx/searxng.msg
msgid "active users"
msgstr ""
msgstr "Người dùng hoạt động"
#. SOCIAL_MEDIA_TERMS['COMMENTS']
#: searx/engines/discourse.py:157 searx/engines/hackernews.py:78
#: searx/engines/lemmy.py:130 searx/searxng.msg
msgid "comments"
msgstr ""
msgstr "Bình luận"
#. SOCIAL_MEDIA_TERMS['USER']
#: searx/engines/lemmy.py:129 searx/engines/lemmy.py:164 searx/searxng.msg
@ -454,7 +456,7 @@ msgstr "Tính toán {functions} của các đối số"
#: searx/engines/mozhi.py:57
msgid "Synonyms"
msgstr ""
msgstr "Đồng nghĩa"
#: searx/engines/openstreetmap.py:159
msgid "Get directions"
@ -541,9 +543,8 @@ msgid "hash digest"
msgstr "hash băm"
#: searx/plugins/hostnames.py:103
#, fuzzy
msgid "Hostnames plugin"
msgstr "Mấy chủ bổ trợ"
msgstr "Bổ trợ tên máy chủ"
#: searx/plugins/hostnames.py:104
msgid "Rewrite hostnames, remove results or prioritize them based on the hostname"
@ -578,7 +579,7 @@ msgstr "Địa chỉ IP của bạn: "
#: searx/plugins/self_info.py:31
msgid "Your user-agent is: "
msgstr ""
msgstr "Tác nhân người dùng của bạn là: "
#: searx/plugins/tor_check.py:24
msgid "Tor check plugin"
@ -623,7 +624,7 @@ msgstr "Loại bỏ các đối số theo dõi từ URL trả về"
#: searx/plugins/unit_converter.py:29
msgid "Convert between units"
msgstr ""
msgstr "Chuyển đổi giữa các đại lượng"
#: searx/templates/simple/404.html:4
msgid "Page not found"
@ -690,7 +691,7 @@ msgstr "Độ dài"
#: searx/templates/simple/macros.html:41
msgid "Views"
msgstr ""
msgstr "Lượt xem"
#: searx/templates/simple/macros.html:42
#: searx/templates/simple/result_templates/files.html:34
@ -933,9 +934,8 @@ msgid "Checker"
msgstr "Người kiểm duyệt"
#: searx/templates/simple/stats.html:131
#, fuzzy
msgid "Failed test"
msgstr "Bản kiểm thử không đạt"
msgstr "Bài kiểm tra không đạt"
#: searx/templates/simple/stats.html:132
msgid "Comment(s)"
@ -951,7 +951,7 @@ msgstr "Tin nhắn từ công cụ tìm kiếm"
#: searx/templates/simple/elements/engines_msg.html:7
msgid "seconds"
msgstr ""
msgstr "giây"
#: searx/templates/simple/elements/search_url.html:3
msgid "Search URL"
@ -1208,11 +1208,11 @@ msgstr ""
#: searx/templates/simple/preferences/engines.html:15
msgid "Enable all"
msgstr ""
msgstr "Bật tất cả"
#: searx/templates/simple/preferences/engines.html:16
msgid "Disable all"
msgstr ""
msgstr "Tắt tất cả"
#: searx/templates/simple/preferences/engines.html:25
msgid "!bang"
@ -1232,11 +1232,11 @@ msgstr "Thời gian tối đa"
#: searx/templates/simple/preferences/favicon.html:2
msgid "Favicon Resolver"
msgstr ""
msgstr "Bộ phân giải biểu tượng web"
#: searx/templates/simple/preferences/favicon.html:15
msgid "Display favicons near search results"
msgstr ""
msgstr "Hiển thị biểu tượng web gần kết quả tìm kiếm"
#: searx/templates/simple/preferences/footer.html:2
msgid ""

View File

@ -87,10 +87,7 @@ from searx.webadapter import (
get_selected_categories,
parse_lang,
)
from searx.utils import (
gen_useragent,
dict_subset,
)
from searx.utils import gen_useragent, dict_subset
from searx.version import VERSION_STRING, GIT_URL, GIT_BRANCH
from searx.query import RawTextQuery
from searx.plugins import Plugin, plugins, initialize as plugin_initialize
@ -104,13 +101,7 @@ from searx.answerers import (
answerers,
ask,
)
from searx.metrics import (
get_engines_stats,
get_engine_errors,
get_reliabilities,
histogram,
counter,
)
from searx.metrics import get_engines_stats, get_engine_errors, get_reliabilities, histogram, counter, openmetrics
from searx.flaskfix import patch_application
from searx.locales import (
@ -1218,6 +1209,30 @@ def stats_checker():
return jsonify(result)
@app.route('/metrics')
def stats_open_metrics():
password = settings['general'].get("open_metrics")
if not (settings['general'].get("enable_metrics") and password):
return Response('open metrics is disabled', status=404, mimetype='text/plain')
if not request.authorization or request.authorization.password != password:
return Response('access forbidden', status=401, mimetype='text/plain')
filtered_engines = dict(filter(lambda kv: request.preferences.validate_token(kv[1]), engines.items()))
checker_results = checker_get_result()
checker_results = (
checker_results['engines'] if checker_results['status'] == 'ok' and 'engines' in checker_results else {}
)
engine_stats = get_engines_stats(filtered_engines)
engine_reliabilities = get_reliabilities(filtered_engines, checker_results)
metrics_text = openmetrics(engine_stats, engine_reliabilities)
return Response(metrics_text, mimetype='text/plain')
@app.route('/robots.txt', methods=['GET'])
def robots():
return Response(