From d3862614e55b539ffc297a03c999f6136a26592b Mon Sep 17 00:00:00 2001 From: Stanislav Chzhen Date: Thu, 9 Nov 2023 16:14:05 +0300 Subject: [PATCH] Pull request 2054: 6220-average-processing-time Updates #6220. Squashed commit of the following: commit 2ad87979b4f8ade2cad8a1b86b8e0663dd53b098 Author: Stanislav Chzhen Date: Thu Nov 9 13:55:09 2023 +0300 all: upd go commit 387200c3de899e6f59e8d2455cb2aa2b7194b311 Merge: 37f2855ed f8fe9bfc8 Author: Stanislav Chzhen Date: Thu Nov 9 13:49:59 2023 +0300 Merge branch 'master' into 6220-average-processing-time commit 37f2855ed104c20faa3f4d57d48bd221a59cacb3 Author: Stanislav Chzhen Date: Wed Nov 8 17:08:13 2023 +0300 client: upd locales commit a09be4183811cef29b594f9916dc76b87f89d304 Author: Stanislav Chzhen Date: Tue Nov 7 20:46:24 2023 +0300 all: imp docs commit f0b85ac1fef366da37b996d53e29d76d6279691f Author: Stanislav Chzhen Date: Fri Nov 3 14:17:32 2023 +0300 all: add todo commit 48a5879865a1625410787edef6d78b309056af7b Author: Stanislav Chzhen Date: Fri Nov 3 13:38:14 2023 +0300 all: add upstream time commit 4d7431c00e24f8a9d3e86160851b5ef3bd9d03fa Author: Stanislav Chzhen Date: Tue Oct 31 17:27:19 2023 +0300 all: upd chlog commit 040b6b9cdebea2c9789d4d38f2a0a40ef4cb26d7 Author: Stanislav Chzhen Date: Tue Oct 31 15:42:04 2023 +0300 all: imp average processing time --- .github/workflows/build.yml | 2 +- .github/workflows/lint.yml | 2 +- CHANGELOG.md | 2 + bamboo-specs/release.yaml | 2 +- bamboo-specs/snapcraft.yaml | 2 +- bamboo-specs/test.yaml | 2 +- client/src/__locales/be.json | 1 - client/src/__locales/cs.json | 1 - client/src/__locales/da.json | 1 - client/src/__locales/de.json | 1 - client/src/__locales/en.json | 3 +- client/src/__locales/es.json | 1 - client/src/__locales/fa.json | 1 - client/src/__locales/fi.json | 1 - client/src/__locales/fr.json | 1 - client/src/__locales/hr.json | 1 - client/src/__locales/hu.json | 1 - client/src/__locales/id.json | 1 - client/src/__locales/it.json | 1 - client/src/__locales/ja.json | 1 - client/src/__locales/ko.json | 1 - client/src/__locales/nl.json | 1 - client/src/__locales/no.json | 1 - client/src/__locales/pl.json | 1 - client/src/__locales/pt-br.json | 1 - client/src/__locales/pt-pt.json | 1 - client/src/__locales/ro.json | 1 - client/src/__locales/ru.json | 1 - client/src/__locales/si-lk.json | 1 - client/src/__locales/sk.json | 1 - client/src/__locales/sl.json | 1 - client/src/__locales/sr-cs.json | 1 - client/src/__locales/sv.json | 1 - client/src/__locales/tr.json | 1 - client/src/__locales/uk.json | 1 - client/src/__locales/vi.json | 1 - client/src/__locales/zh-cn.json | 1 - client/src/__locales/zh-tw.json | 1 - .../components/Dashboard/UpstreamAvgTime.js | 4 +- go.mod | 3 +- go.sum | 4 +- internal/dnsforward/dnsforward.go | 5 +-- internal/dnsforward/msg.go | 8 ++-- internal/dnsforward/stats.go | 39 ++++++++----------- internal/stats/stats_internal_test.go | 8 ++-- internal/stats/stats_test.go | 32 ++++++++------- internal/stats/unit.go | 19 +++++---- scripts/make/go-lint.sh | 2 +- 48 files changed, 70 insertions(+), 100 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e154dd3..f1c35913 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ 'name': 'build' 'env': - 'GO_VERSION': '1.20.10' + 'GO_VERSION': '1.20.11' 'NODE_VERSION': '16' 'on': diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 11a96f8b..144cc3f4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,7 +1,7 @@ 'name': 'lint' 'env': - 'GO_VERSION': '1.20.10' + 'GO_VERSION': '1.20.11' 'on': 'push': diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d3fa6ef..11ce8ef5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ NOTE: Add new changes BELOW THIS COMMENT. ### Fixed +- Average request processing time calculation ([#6220]). - Redundant shortening long client names in the Top Clients table ([#6338]). - Scrolling column headers in the tables ([#6337]). - `$important,dnsrewrite` rules do not take precedence over allowlist rules @@ -44,6 +45,7 @@ NOTE: Add new changes BELOW THIS COMMENT. [#4977]: https://github.com/AdguardTeam/AdGuardHome/issues/4977 [#6204]: https://github.com/AdguardTeam/AdGuardHome/issues/6204 +[#6220]: https://github.com/AdguardTeam/AdGuardHome/issues/6220 [#6329]: https://github.com/AdguardTeam/AdGuardHome/issues/6329 [#6335]: https://github.com/AdguardTeam/AdGuardHome/issues/6335 [#6337]: https://github.com/AdguardTeam/AdGuardHome/issues/6337 diff --git a/bamboo-specs/release.yaml b/bamboo-specs/release.yaml index f868e363..6655d9bb 100644 --- a/bamboo-specs/release.yaml +++ b/bamboo-specs/release.yaml @@ -7,7 +7,7 @@ # Make sure to sync any changes with the branch overrides below. 'variables': 'channel': 'edge' - 'dockerGo': 'adguard/golang-ubuntu:7.4' + 'dockerGo': 'adguard/golang-ubuntu:7.5' 'stages': - 'Build frontend': diff --git a/bamboo-specs/snapcraft.yaml b/bamboo-specs/snapcraft.yaml index 854ef3cc..8380658e 100644 --- a/bamboo-specs/snapcraft.yaml +++ b/bamboo-specs/snapcraft.yaml @@ -10,7 +10,7 @@ # Make sure to sync any changes with the branch overrides below. 'variables': 'channel': 'edge' - 'dockerGo': 'adguard/golang-ubuntu:7.4' + 'dockerGo': 'adguard/golang-ubuntu:7.5' 'snapcraftChannel': 'edge' 'stages': diff --git a/bamboo-specs/test.yaml b/bamboo-specs/test.yaml index bacb94ef..746b599d 100644 --- a/bamboo-specs/test.yaml +++ b/bamboo-specs/test.yaml @@ -5,7 +5,7 @@ 'key': 'AHBRTSPECS' 'name': 'AdGuard Home - Build and run tests' 'variables': - 'dockerGo': 'adguard/golang-ubuntu:7.4' + 'dockerGo': 'adguard/golang-ubuntu:7.5' 'stages': - 'Tests': diff --git a/client/src/__locales/be.json b/client/src/__locales/be.json index 3dd62d98..b6ed5cdd 100644 --- a/client/src/__locales/be.json +++ b/client/src/__locales/be.json @@ -143,7 +143,6 @@ "enforced_save_search": "Ужыты бяспечны пошук", "number_of_dns_query_to_safe_search": "Колькасць запытаў DNS для пошукавых сістэм, для якіх быў ужыты Бяспечны пошук", "average_processing_time": "Сярэдні час апрацоўкі запыту", - "processing_time": "Час апрацоўкі", "average_processing_time_hint": "Сярэдні час для апрацоўкі запыту DNS у мілісекундах", "block_domain_use_filters_and_hosts": "Блакаваць дамены з выкарыстаннем фільтраў і файлаў хастоў", "filters_block_toggle_hint": "Вы можаце наладзіць правілы блакавання ў «Фільтрах».", diff --git a/client/src/__locales/cs.json b/client/src/__locales/cs.json index 7db7aae9..522218da 100644 --- a/client/src/__locales/cs.json +++ b/client/src/__locales/cs.json @@ -143,7 +143,6 @@ "enforced_save_search": "Vynucené bezpečné vyhledávání", "number_of_dns_query_to_safe_search": "Počet požadavků DNS na vyhledávače, při kterých bylo vynucené bezpečné vyhledávání", "average_processing_time": "Průměrný čas zpracování", - "processing_time": "Doba zpracování", "average_processing_time_hint": "Průměrný čas zpracování požadavků DNS v milisekundách", "block_domain_use_filters_and_hosts": "Blokovat domény pomocí filtrů a seznamů adres", "filters_block_toggle_hint": "Pravidla blokování můžete nastavit v nastavení Filtry.", diff --git a/client/src/__locales/da.json b/client/src/__locales/da.json index 064d4123..c5e0e1ec 100644 --- a/client/src/__locales/da.json +++ b/client/src/__locales/da.json @@ -143,7 +143,6 @@ "enforced_save_search": "Håndhævet sikker søgning", "number_of_dns_query_to_safe_search": "Antallet af DNS-forespørgsler til søgemaskiner, hvor Sikker Søgning blev håndhævet", "average_processing_time": "Gennemsnitlig behandlingstid", - "processing_time": "Behandlingstid", "average_processing_time_hint": "Gennemsnitlig behandlingstid i millisekunder af DNS-forespørgsel", "block_domain_use_filters_and_hosts": "Blokér domæner vha. filtre og værtsfiler", "filters_block_toggle_hint": "Du kan opsætte blokeringsregler i Filterindstillingerne.", diff --git a/client/src/__locales/de.json b/client/src/__locales/de.json index 7c40eb89..0f53921c 100644 --- a/client/src/__locales/de.json +++ b/client/src/__locales/de.json @@ -143,7 +143,6 @@ "enforced_save_search": "Sichere Suche erzwungen", "number_of_dns_query_to_safe_search": "Anzahl der DNS-Anfragen bei denen Sichere Suche für Suchanfragen erzwungen wurde", "average_processing_time": "Durchschnittliche Bearbeitungsdauer", - "processing_time": "Verarbeitungszeit", "average_processing_time_hint": "Durchschnittliche Zeit in Millisekunden zur Bearbeitung von DNS-Anfragen", "block_domain_use_filters_and_hosts": "Domains durch Filter und Host-Dateien sperren", "filters_block_toggle_hint": "Sie können Blockierregeln in den Filtereinstellungen erstellen.", diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index f7c572ef..5e0bf6d1 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -144,7 +144,8 @@ "enforced_save_search": "Enforced safe search", "number_of_dns_query_to_safe_search": "The number of DNS requests to search engines for which Safe Search was enforced", "average_processing_time": "Average processing time", - "processing_time": "Processing time", + "average_upstream_response_time": "Average upstream response time", + "response_time": "Response time", "average_processing_time_hint": "Average time in milliseconds on processing a DNS request", "block_domain_use_filters_and_hosts": "Block domains using filters and hosts files", "filters_block_toggle_hint": "You can setup blocking rules in the Filters settings.", diff --git a/client/src/__locales/es.json b/client/src/__locales/es.json index 2af3c571..615d8353 100644 --- a/client/src/__locales/es.json +++ b/client/src/__locales/es.json @@ -143,7 +143,6 @@ "enforced_save_search": "Búsquedas seguras forzadas", "number_of_dns_query_to_safe_search": "Número de peticiones DNS a los motores de búsqueda para los que se aplicó la búsqueda segura forzada", "average_processing_time": "Tiempo promedio de procesamiento", - "processing_time": "Tiempo de procesamiento", "average_processing_time_hint": "Tiempo promedio en milisegundos al procesar una petición DNS", "block_domain_use_filters_and_hosts": "Bloquear dominios usando filtros y archivos hosts", "filters_block_toggle_hint": "Puedes configurar las reglas de bloqueo en la configuración de filtros.", diff --git a/client/src/__locales/fa.json b/client/src/__locales/fa.json index 41197a67..907b95cf 100644 --- a/client/src/__locales/fa.json +++ b/client/src/__locales/fa.json @@ -139,7 +139,6 @@ "enforced_save_search": "جستجوی اَمن اجبار شده", "number_of_dns_query_to_safe_search": "تعداد درخواست های DNS برای موتور جستجو که جستجوی اَمن اجبار شده", "average_processing_time": "میانگین زمان پردازش", - "processing_time": "زمان پردازش", "average_processing_time_hint": "زمان میانگین بر هزارم ثانیه در پردازش درخواست DNS", "block_domain_use_filters_and_hosts": "مسدودسازی دامنه ها توسط فیلترها و فایل های میزبان", "filters_block_toggle_hint": "میتوانید دستورات مسدودسازی را در تنظیمات فیلترها راه اندازی کنید.", diff --git a/client/src/__locales/fi.json b/client/src/__locales/fi.json index 5a3f4fb5..cfd56dd6 100644 --- a/client/src/__locales/fi.json +++ b/client/src/__locales/fi.json @@ -143,7 +143,6 @@ "enforced_save_search": "Turvallinen haku pakotettiin", "number_of_dns_query_to_safe_search": "DNS-pyyntöjen määrä, joille turvallinen haku pakotettiin käyttöön", "average_processing_time": "Keskimääräinen käsittelyaika", - "processing_time": "Käsittelyaika", "average_processing_time_hint": "Keskimääräinen DNS-pyynnön käsittelyyn kulutettu aika millisekunteina", "block_domain_use_filters_and_hosts": "Estä verkkotunnuksia suodattimilla ja hosts-tiedostoilla", "filters_block_toggle_hint": "Voit määrittää estosääntöjä suodatinasetuksissa.", diff --git a/client/src/__locales/fr.json b/client/src/__locales/fr.json index 146a3860..092d0de0 100644 --- a/client/src/__locales/fr.json +++ b/client/src/__locales/fr.json @@ -143,7 +143,6 @@ "enforced_save_search": "Recherche sécurisée forcée", "number_of_dns_query_to_safe_search": "Le nombre de requêtes DNS faites avec la Recherche securisée", "average_processing_time": "Temps moyen de traitement", - "processing_time": "Délai de traitement", "average_processing_time_hint": "Temps moyen (en millisecondes) de traitement d'une requête DNS", "block_domain_use_filters_and_hosts": "Bloquez les domaines à l'aide des filtres et fichiers hosts", "filters_block_toggle_hint": "Vous pouvez configurer les règles de filtrage dans les paramètres des Filtres.", diff --git a/client/src/__locales/hr.json b/client/src/__locales/hr.json index 5cef8b1b..977c5897 100644 --- a/client/src/__locales/hr.json +++ b/client/src/__locales/hr.json @@ -143,7 +143,6 @@ "enforced_save_search": "Omogućeno sigurno pretraživanje", "number_of_dns_query_to_safe_search": "Broj DNS zahtjeva prema pretraživačima za koje je omogućeno Sigurno pretraživanje", "average_processing_time": "Prosječno vrijeme obrade", - "processing_time": "Vrijeme obrade", "average_processing_time_hint": "Prosječno vrijeme u milisekundama za obradu DNS zahtjeva", "block_domain_use_filters_and_hosts": "Blokiraj domene koristeći filtre ili hosts datoteke", "filters_block_toggle_hint": "Pravila blokiranja možete postaviti u postavkama filtara.", diff --git a/client/src/__locales/hu.json b/client/src/__locales/hu.json index 8dc1b000..6f819925 100644 --- a/client/src/__locales/hu.json +++ b/client/src/__locales/hu.json @@ -143,7 +143,6 @@ "enforced_save_search": "Kényszerített biztonságos keresés", "number_of_dns_query_to_safe_search": "A biztonságos keresésre kényszerített DNS lekérdezések száma", "average_processing_time": "Átlagos feldolgozási idő", - "processing_time": "Feldolgozási idő", "average_processing_time_hint": "A DNS lekérdezések feldolgozásához szükséges átlagos idő milliszekundumban", "block_domain_use_filters_and_hosts": "Domainek blokkolása szűrők és hosztfájlok használatával", "filters_block_toggle_hint": "A szűrőbeállításoknál megadhatja a blokkolási szabályokat.", diff --git a/client/src/__locales/id.json b/client/src/__locales/id.json index 38ffba0a..f1cb8d91 100644 --- a/client/src/__locales/id.json +++ b/client/src/__locales/id.json @@ -143,7 +143,6 @@ "enforced_save_search": "Paksa pencarian aman", "number_of_dns_query_to_safe_search": "Jumlah perminataan DNS ke mesin pencari yang dipaksa Pencarian Aman", "average_processing_time": "Rata-rata waktu pemrosesan", - "processing_time": "Waktu pemrosesan", "average_processing_time_hint": "Rata-rata waktu dalam milidetik untuk pemrosesan sebuah permintaan DNS", "block_domain_use_filters_and_hosts": "Blokir domain menggunakan filter dan file hosts", "filters_block_toggle_hint": "Anda dapat menyiapkan aturan pemblokiran di pengaturan Penyaringan.", diff --git a/client/src/__locales/it.json b/client/src/__locales/it.json index 4748a82a..1b895ade 100644 --- a/client/src/__locales/it.json +++ b/client/src/__locales/it.json @@ -143,7 +143,6 @@ "enforced_save_search": "Ricerca sicura forzata", "number_of_dns_query_to_safe_search": "Numero di richieste DNS dai motori di ricerca per i quali la Ricerca Sicura è stata forzata", "average_processing_time": "Tempo di elaborazione medio", - "processing_time": "Tempo di elaborazione", "average_processing_time_hint": "Tempo medio in millisecondi per elaborare una richiesta DNS", "block_domain_use_filters_and_hosts": "Blocca domini utilizzando filtri e file hosts", "filters_block_toggle_hint": "Puoi impostare le regole di blocco nelle impostazioni dei Filtri.", diff --git a/client/src/__locales/ja.json b/client/src/__locales/ja.json index f97b74db..c7e6e179 100644 --- a/client/src/__locales/ja.json +++ b/client/src/__locales/ja.json @@ -143,7 +143,6 @@ "enforced_save_search": "強制されたセーフサーチ", "number_of_dns_query_to_safe_search": "セーフサーチが強制適用された検索エンジンへのDNSリクエストの数", "average_processing_time": "平均処理時間", - "processing_time": "処理時間", "average_processing_time_hint": "DNSリクエストの処理にかかる平均時間(ミリ秒単位)", "block_domain_use_filters_and_hosts": "フィルタとhostsファイルを使用してドメインをブロックする", "filters_block_toggle_hint": "フィルタの設定でブロックするルールを設定することができます。", diff --git a/client/src/__locales/ko.json b/client/src/__locales/ko.json index 7a6b6e5d..af9b191d 100644 --- a/client/src/__locales/ko.json +++ b/client/src/__locales/ko.json @@ -143,7 +143,6 @@ "enforced_save_search": "세이프서치 강제", "number_of_dns_query_to_safe_search": "세이프서치가 적용된 검색 엔진에 대해 DNS 요청 수", "average_processing_time": "평균처리 시간", - "processing_time": "처리 시간", "average_processing_time_hint": "DNS 요청 처리시 평균 시간(밀리초)", "block_domain_use_filters_and_hosts": "필터 및 호스트 파일을 사용하여 도메인 차단", "filters_block_toggle_hint": "차단규칙필터을 설정할 수 있습니다.", diff --git a/client/src/__locales/nl.json b/client/src/__locales/nl.json index c243773e..e5792eed 100644 --- a/client/src/__locales/nl.json +++ b/client/src/__locales/nl.json @@ -143,7 +143,6 @@ "enforced_save_search": "Geforceerd veilig zoeken", "number_of_dns_query_to_safe_search": "Aantal DNS aanvragen in zoekmachines dmv geforceerd veilig zoeken", "average_processing_time": "Gemiddelde procestijd", - "processing_time": "Verwerkingstijd", "average_processing_time_hint": "Gemiddelde verwerkingstijd in milliseconden van een DNS aanvraag", "block_domain_use_filters_and_hosts": "Domeinen blokkeren d.m.v. filters en host-bestanden", "filters_block_toggle_hint": "Je kan blokkeringsregels toevoegen in de Filters instellingen.", diff --git a/client/src/__locales/no.json b/client/src/__locales/no.json index 02618184..0d9a5d39 100644 --- a/client/src/__locales/no.json +++ b/client/src/__locales/no.json @@ -128,7 +128,6 @@ "enforced_save_search": "Påtvungede barnevennlige søk", "number_of_dns_query_to_safe_search": "Antall DNS-forespørsler til søkemotorer der \"Safe Search\" ble fremtvunget", "average_processing_time": "Gjennomsnittlig behandlingstid", - "processing_time": "Behandlingstid", "average_processing_time_hint": "Gjennomsnittstid for behandling av DNS-forespørsler i millisekunder", "block_domain_use_filters_and_hosts": "Blokker domener ved hjelp av filtre, «hosts»-filer, og rå domener", "filters_block_toggle_hint": "Du kan sette opp blokkeringsoppføringer i Filtre-innstillingene.", diff --git a/client/src/__locales/pl.json b/client/src/__locales/pl.json index 68f5802f..91865758 100644 --- a/client/src/__locales/pl.json +++ b/client/src/__locales/pl.json @@ -143,7 +143,6 @@ "enforced_save_search": "Wymuszone bezpieczne wyszukiwanie", "number_of_dns_query_to_safe_search": "Liczba żądań DNS kierowanych do wyszukiwarek, dla których wymuszono Bezpieczne wyszukiwanie", "average_processing_time": "Średni czas przetwarzania", - "processing_time": "Czas przetwarzania", "average_processing_time_hint": "Średni czas przetwarzania żądania DNS liczony w milisekundach", "block_domain_use_filters_and_hosts": "Zablokuj domeny za pomocą filtrów i plików host", "filters_block_toggle_hint": "Możesz skonfigurować reguły blokowania w ustawieniach Filtry.", diff --git a/client/src/__locales/pt-br.json b/client/src/__locales/pt-br.json index 28fd4529..bf719198 100644 --- a/client/src/__locales/pt-br.json +++ b/client/src/__locales/pt-br.json @@ -143,7 +143,6 @@ "enforced_save_search": "Forçar pesquisa segura", "number_of_dns_query_to_safe_search": "O número de solicitações de DNS para mecanismos de pesquisa para os quais a pesquisa segura foi aplicada", "average_processing_time": "Tempo médio de processamento", - "processing_time": "Tempo de processamento", "average_processing_time_hint": "Tempo médio em milissegundos no processamento de uma solicitação DNS", "block_domain_use_filters_and_hosts": "Bloquear domínios usando arquivos de filtros e hosts", "filters_block_toggle_hint": "Você pode configurar as regras de bloqueio nas configurações de Filtros.", diff --git a/client/src/__locales/pt-pt.json b/client/src/__locales/pt-pt.json index c03d9b5c..d6e775fc 100644 --- a/client/src/__locales/pt-pt.json +++ b/client/src/__locales/pt-pt.json @@ -143,7 +143,6 @@ "enforced_save_search": "Forçar pesquisa segura", "number_of_dns_query_to_safe_search": "O número de solicitações de DNS para motores de busca para os quais a pesquisa segura foi aplicada", "average_processing_time": "Tempo médio de processamento", - "processing_time": "Tempo de processamento", "average_processing_time_hint": "Tempo médio em milissegundos no processamento de uma solicitação DNS", "block_domain_use_filters_and_hosts": "Bloquear domínios usando ficheiros de filtros e hosts", "filters_block_toggle_hint": "Pode configurar as regras de bloqueio nas configurações de Filtros.", diff --git a/client/src/__locales/ro.json b/client/src/__locales/ro.json index 0387e1af..4ab6397e 100644 --- a/client/src/__locales/ro.json +++ b/client/src/__locales/ro.json @@ -143,7 +143,6 @@ "enforced_save_search": "Căutare protejată întărită", "number_of_dns_query_to_safe_search": "Numărul de interogări DNS pe motoarele de căutare pentru care a fost impusă Căutarea Sigură", "average_processing_time": "Timpul mediu de procesare", - "processing_time": "Timp de procesare", "average_processing_time_hint": "Timp mediu în milisecunde la procesarea unei cereri DNS", "block_domain_use_filters_and_hosts": "Blocați domenii folosind filtre și fișiere hosts", "filters_block_toggle_hint": "Puteți configura regulile de blocare în setările Filtre.", diff --git a/client/src/__locales/ru.json b/client/src/__locales/ru.json index 8a5cbc9d..3b5dcc23 100644 --- a/client/src/__locales/ru.json +++ b/client/src/__locales/ru.json @@ -143,7 +143,6 @@ "enforced_save_search": "Применён безопасный поиск", "number_of_dns_query_to_safe_search": "Количество запросов DNS для поисковых систем, для которых был применён Безопасный поиск", "average_processing_time": "Среднее время обработки запроса", - "processing_time": "Время обработки", "average_processing_time_hint": "Среднее время для обработки запроса DNS в миллисекундах", "block_domain_use_filters_and_hosts": "Блокировать домены с использованием фильтров и файлов hosts", "filters_block_toggle_hint": "Вы можете настроить правила блокировки в «Фильтрах».", diff --git a/client/src/__locales/si-lk.json b/client/src/__locales/si-lk.json index 2ee469ab..3975c8a4 100644 --- a/client/src/__locales/si-lk.json +++ b/client/src/__locales/si-lk.json @@ -122,7 +122,6 @@ "enforced_save_search": "ආරක්‍ෂිත සෙවීම බලාත්මක කළ", "number_of_dns_query_to_safe_search": "ආරක්‍ෂිත සෙවීම බලාත්මක කළ සෙවුම් යන්ත්‍ර සඳහා ව.නා.ප. ඉල්ලීම් ගණන", "average_processing_time": "සාමාන්‍ය සැකසුම් කාලය", - "processing_time": "සැකසුම් කාලය", "average_processing_time_hint": "ව.නා.ප. ඉල්ලීමක් සැකසීමේ සාමාන්‍ය කාලය මිලි තත්පර වලින්", "block_domain_use_filters_and_hosts": "පෙරහන් හා සත්කාරක ගොනු භාවිතයෙන් වසම් අවහිර කරන්න", "filters_block_toggle_hint": "ඔබට අවහිර කිරීමේ නීති පෙරහන් තුළ පිහිටුවිය හැකිය.", diff --git a/client/src/__locales/sk.json b/client/src/__locales/sk.json index c3800be5..a5d022b8 100644 --- a/client/src/__locales/sk.json +++ b/client/src/__locales/sk.json @@ -143,7 +143,6 @@ "enforced_save_search": "Vynútené bezpečné vyhľadávanie", "number_of_dns_query_to_safe_search": "Počet DNS dopytov na vyhľadávače, pri ktorých bolo vynútené bezpečné vyhľadávanie", "average_processing_time": "Priemerný čas spracovania", - "processing_time": "Doba spracovania", "average_processing_time_hint": "Priemerný čas spracovania DNS dopytu v milisekundách", "block_domain_use_filters_and_hosts": "Blokovať domény pomocou filtrov a zoznamov adries", "filters_block_toggle_hint": "Pravidlá blokovania môžete nastaviť v nastaveniach Filtre.", diff --git a/client/src/__locales/sl.json b/client/src/__locales/sl.json index 1d25aefb..8dbcbbf5 100644 --- a/client/src/__locales/sl.json +++ b/client/src/__locales/sl.json @@ -143,7 +143,6 @@ "enforced_save_search": "Prisilno varno iskanje", "number_of_dns_query_to_safe_search": "Število zahtev DNS za iskalnike, za katere je bilo uveljavljeno varno iskanje", "average_processing_time": "Povprečni čas obdelave", - "processing_time": "Čas obdelave", "average_processing_time_hint": "Povprečni čas v milisekundah pri obdelavi zahteve DNS", "block_domain_use_filters_and_hosts": "Onemogoči domene s filtri in gostiteljskimi datotekami", "filters_block_toggle_hint": "Pravila zaviranja lahko nastavite v nastavitvah Filtri.", diff --git a/client/src/__locales/sr-cs.json b/client/src/__locales/sr-cs.json index 4406104e..84378ba6 100644 --- a/client/src/__locales/sr-cs.json +++ b/client/src/__locales/sr-cs.json @@ -143,7 +143,6 @@ "enforced_save_search": "Nametni sigurno pretraživanje", "number_of_dns_query_to_safe_search": "Broj DNS zahteva ka pretraživačima za koje je nametnuto sigurno pretraživanje", "average_processing_time": "Prosečno vreme obrade", - "processing_time": "Vreme obrade", "average_processing_time_hint": "Prosečno vreme u milisekundama za obradu DNS zahteva", "block_domain_use_filters_and_hosts": "Blokiraj domene koristeći filtere i hosts datoteke", "filters_block_toggle_hint": "Možete postaviti pravila blokiranja u Filters postavkama.", diff --git a/client/src/__locales/sv.json b/client/src/__locales/sv.json index 90834a8a..498c6428 100644 --- a/client/src/__locales/sv.json +++ b/client/src/__locales/sv.json @@ -143,7 +143,6 @@ "enforced_save_search": "Aktivering av Säker surf", "number_of_dns_query_to_safe_search": "Antalet DNS-förfrågningar mot sökmotorer där Säker surf tvingats", "average_processing_time": "Genomsnittlig processtid", - "processing_time": "Bearbetningstid", "average_processing_time_hint": "Genomsnittlig processtid i millisekunder för DNS-förfrågning", "block_domain_use_filters_and_hosts": "Blockera domäner med filter- och värdfiler", "filters_block_toggle_hint": "Du kan ställa in egna blockerings regler i Filterinställningar.", diff --git a/client/src/__locales/tr.json b/client/src/__locales/tr.json index 64f61bed..319bb702 100644 --- a/client/src/__locales/tr.json +++ b/client/src/__locales/tr.json @@ -143,7 +143,6 @@ "enforced_save_search": "Uygulanan güvenli arama", "number_of_dns_query_to_safe_search": "Güvenli Aramanın uygulandığı arama motorlarına gönderilen DNS isteklerinin sayısı", "average_processing_time": "Ortalama işlem süresi", - "processing_time": "İşlem süresi", "average_processing_time_hint": "Bir DNS isteğinin milisaniye cinsinden ortalama işlem süresi", "block_domain_use_filters_and_hosts": "Filtre ve hosts dosyalarını kullanarak alan adlarını engelle", "filters_block_toggle_hint": "Filtreler ayarlarında engelleme kuralları oluşturabilirsiniz.", diff --git a/client/src/__locales/uk.json b/client/src/__locales/uk.json index 5817278b..de73f551 100644 --- a/client/src/__locales/uk.json +++ b/client/src/__locales/uk.json @@ -143,7 +143,6 @@ "enforced_save_search": "Примусовий безпечний пошук", "number_of_dns_query_to_safe_search": "Кількість DNS-запитів до пошукових систем, для яких примусово застосований безпечний пошук", "average_processing_time": "Середній час обробки", - "processing_time": "Час обробки", "average_processing_time_hint": "Середній час обробки DNS запиту в мілісекундах", "block_domain_use_filters_and_hosts": "Блокування доменів за допомогою фільтрів та hosts-файлів", "filters_block_toggle_hint": "Ви можете налаштувати правила блокування в розділі Фільтри.", diff --git a/client/src/__locales/vi.json b/client/src/__locales/vi.json index 66d69538..a9af2ac5 100644 --- a/client/src/__locales/vi.json +++ b/client/src/__locales/vi.json @@ -143,7 +143,6 @@ "enforced_save_search": "Bắt buộc tìm kiếm an toàn", "number_of_dns_query_to_safe_search": "Số yêu cầu DNS tới công cụ tìm kiếm đã chuyển thành tìm kiếm an toàn", "average_processing_time": "Thời gian xử lý trung bình", - "processing_time": "Thời gian xử lý", "average_processing_time_hint": "Thời gian trung bình cho một yêu cầu DNS tính bằng mili giây", "block_domain_use_filters_and_hosts": "Chặn tên miền sử dụng các bộ lọc và file hosts", "filters_block_toggle_hint": "Bạn có thể thiết lập quy tắc chặn tại cài đặt Bộ lọc.", diff --git a/client/src/__locales/zh-cn.json b/client/src/__locales/zh-cn.json index 825ad7d2..c94a8f25 100644 --- a/client/src/__locales/zh-cn.json +++ b/client/src/__locales/zh-cn.json @@ -143,7 +143,6 @@ "enforced_save_search": "强制安全搜索", "number_of_dns_query_to_safe_search": "启用强制安全搜索后对搜索引擎的 DNS 请求总数", "average_processing_time": "平均处理时间", - "processing_time": "处理时间", "average_processing_time_hint": "处理 DNS 请求的平均时间(毫秒)", "block_domain_use_filters_and_hosts": "使用过滤器和 Hosts 文件以拦截指定域名", "filters_block_toggle_hint": "你可以在 过滤器 设置中添加过滤规则。", diff --git a/client/src/__locales/zh-tw.json b/client/src/__locales/zh-tw.json index 5e7ccb40..418396ab 100644 --- a/client/src/__locales/zh-tw.json +++ b/client/src/__locales/zh-tw.json @@ -143,7 +143,6 @@ "enforced_save_search": "已強制執行的安全搜尋", "number_of_dns_query_to_safe_search": "安全搜尋已被強制執行之屬於搜尋引擎的 DNS 請求之數量", "average_processing_time": "平均的處理時間", - "processing_time": "處理時間", "average_processing_time_hint": "在處理一項 DNS 請求時以毫秒(ms)計的平均時間", "block_domain_use_filters_and_hosts": "透過過濾器和主機檔案封鎖網域", "filters_block_toggle_hint": "您可在過濾器設定中設置封鎖規則。", diff --git a/client/src/components/Dashboard/UpstreamAvgTime.js b/client/src/components/Dashboard/UpstreamAvgTime.js index eb198189..bac27931 100644 --- a/client/src/components/Dashboard/UpstreamAvgTime.js +++ b/client/src/components/Dashboard/UpstreamAvgTime.js @@ -38,7 +38,7 @@ const UpstreamAvgTime = ({ subtitle, }) => ( processing_time, + Header: response_time, accessor: 'count', maxWidth: 190, Cell: TimeCell, diff --git a/go.mod b/go.mod index 289d740c..010061c1 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,8 @@ module github.com/AdguardTeam/AdGuardHome go 1.20 require ( - github.com/AdguardTeam/dnsproxy v0.56.3 + // TODO(e.burkov): Update to v0.57.3. + github.com/AdguardTeam/dnsproxy v0.56.4-0.20231031121835-8d20902c442f github.com/AdguardTeam/golibs v0.17.2 github.com/AdguardTeam/urlfilter v0.17.3 github.com/NYTimes/gziphandler v1.1.1 diff --git a/go.sum b/go.sum index 11cd3cca..71886114 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/AdguardTeam/dnsproxy v0.56.3 h1:WP1FooLfZQPHEH2SuwMtJsOurDt32rubGx0OddcsKT0= -github.com/AdguardTeam/dnsproxy v0.56.3/go.mod h1:ZvkbM71HwpilgkCnTubDiR4Ba6x5Qvnhy2iasMWaTDM= +github.com/AdguardTeam/dnsproxy v0.56.4-0.20231031121835-8d20902c442f h1:0fgscvsWpMq5G8Ab653inTgo2TXB6RxM2PjYArfs7t4= +github.com/AdguardTeam/dnsproxy v0.56.4-0.20231031121835-8d20902c442f/go.mod h1:ZvkbM71HwpilgkCnTubDiR4Ba6x5Qvnhy2iasMWaTDM= github.com/AdguardTeam/golibs v0.17.2 h1:vg6wHMjUKscnyPGRvxS5kAt7Uw4YxcJiITZliZ476W8= github.com/AdguardTeam/golibs v0.17.2/go.mod h1:DKhCIXHcUYtBhU8ibTLKh1paUL96n5zhQBlx763sj+U= github.com/AdguardTeam/urlfilter v0.17.3 h1:fg/ObbnO0Cv6aw0tW6N/ETDMhhNvmcUUOZ7HlmKC3rw= diff --git a/internal/dnsforward/dnsforward.go b/internal/dnsforward/dnsforward.go index 6f0a9bbe..d4c61205 100644 --- a/internal/dnsforward/dnsforward.go +++ b/internal/dnsforward/dnsforward.go @@ -354,9 +354,8 @@ func (s *Server) Exchange(ip netip.Addr) (host string, ttl time.Duration, err er } dctx := &proxy.DNSContext{ - Proto: "udp", - Req: req, - StartTime: time.Now(), + Proto: "udp", + Req: req, } var resolver *proxy.Proxy diff --git a/internal/dnsforward/msg.go b/internal/dnsforward/msg.go index 6aa47103..8a4ecd80 100644 --- a/internal/dnsforward/msg.go +++ b/internal/dnsforward/msg.go @@ -2,7 +2,6 @@ package dnsforward import ( "net/netip" - "time" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/dnsproxy/proxy" @@ -270,10 +269,9 @@ func (s *Server) genBlockedHost(request *dns.Msg, newAddr string, d *proxy.DNSCo replReq.RecursionDesired = true newContext := &proxy.DNSContext{ - Proto: d.Proto, - Addr: d.Addr, - StartTime: time.Now(), - Req: &replReq, + Proto: d.Proto, + Addr: d.Addr, + Req: &replReq, } prx := s.proxy() diff --git a/internal/dnsforward/stats.go b/internal/dnsforward/stats.go index 18cb9268..52f83af5 100644 --- a/internal/dnsforward/stats.go +++ b/internal/dnsforward/stats.go @@ -20,11 +20,10 @@ func (s *Server) processQueryLogsAndStats(dctx *dnsContext) (rc resultCode) { log.Debug("dnsforward: started processing querylog and stats") defer log.Debug("dnsforward: finished processing querylog and stats") - elapsed := time.Since(dctx.startTime) pctx := dctx.proxyCtx - q := pctx.Req.Question[0] host := aghnet.NormalizeDomain(q.Name) + processingTime := time.Since(dctx.startTime) ip, _ := netutil.IPAndPortFromAddr(pctx.Addr) ip = slices.Clone(ip) @@ -43,7 +42,7 @@ func (s *Server) processQueryLogsAndStats(dctx *dnsContext) (rc resultCode) { defer s.serverLock.RUnlock() if s.shouldLog(host, qt, cl, ids) { - s.logQuery(dctx, pctx, elapsed, ip) + s.logQuery(dctx, ip, processingTime) } else { log.Debug( "dnsforward: request %s %s %q from %s ignored; not adding to querylog", @@ -55,7 +54,7 @@ func (s *Server) processQueryLogsAndStats(dctx *dnsContext) (rc resultCode) { } if s.shouldCountStat(host, qt, cl, ids) { - s.updateStats(dctx, elapsed, *dctx.result, ipStr) + s.updateStats(dctx, ipStr, processingTime) } else { log.Debug( "dnsforward: request %s %s %q from %s ignored; not counting in stats", @@ -90,12 +89,9 @@ func (s *Server) shouldCountStat(host string, qt, cl uint16, ids []string) (ok b } // logQuery pushes the request details into the query log. -func (s *Server) logQuery( - dctx *dnsContext, - pctx *proxy.DNSContext, - elapsed time.Duration, - ip net.IP, -) { +func (s *Server) logQuery(dctx *dnsContext, ip net.IP, processingTime time.Duration) { + pctx := dctx.proxyCtx + p := &querylog.AddParams{ Question: pctx.Req, ReqECS: pctx.ReqECS, @@ -104,7 +100,7 @@ func (s *Server) logQuery( Result: dctx.result, ClientID: dctx.clientID, ClientIP: ip, - Elapsed: elapsed, + Elapsed: processingTime, AuthenticatedData: dctx.responseAD, } @@ -132,30 +128,27 @@ func (s *Server) logQuery( } // updatesStats writes the request into statistics. -func (s *Server) updateStats( - ctx *dnsContext, - elapsed time.Duration, - res filtering.Result, - clientIP string, -) { - pctx := ctx.proxyCtx +func (s *Server) updateStats(dctx *dnsContext, clientIP string, processingTime time.Duration) { + pctx := dctx.proxyCtx + e := &stats.Entry{ - Domain: aghnet.NormalizeDomain(pctx.Req.Question[0].Name), - Result: stats.RNotFiltered, - Time: elapsed, + Domain: aghnet.NormalizeDomain(pctx.Req.Question[0].Name), + Result: stats.RNotFiltered, + ProcessingTime: processingTime, + UpstreamTime: pctx.QueryDuration, } if pctx.Upstream != nil { e.Upstream = pctx.Upstream.Address() } - if clientID := ctx.clientID; clientID != "" { + if clientID := dctx.clientID; clientID != "" { e.Client = clientID } else { e.Client = clientIP } - switch res.Reason { + switch dctx.result.Reason { case filtering.FilteredSafeBrowsing: e.Result = stats.RSafeBrowsing case filtering.FilteredParental: diff --git a/internal/stats/stats_internal_test.go b/internal/stats/stats_internal_test.go index 9fb6b526..9081dd21 100644 --- a/internal/stats/stats_internal_test.go +++ b/internal/stats/stats_internal_test.go @@ -33,10 +33,10 @@ func TestStats_races(t *testing.T) { writeFunc := func(start, fin *sync.WaitGroup, waitCh <-chan unit, i int) { e := &Entry{ - Domain: fmt.Sprintf("example-%d.org", i), - Client: fmt.Sprintf("client_%d", i), - Result: Result(i)%(resultLast-1) + 1, - Time: time.Since(startTime), + Domain: fmt.Sprintf("example-%d.org", i), + Client: fmt.Sprintf("client_%d", i), + Result: Result(i)%(resultLast-1) + 1, + ProcessingTime: time.Since(startTime), } start.Done() diff --git a/internal/stats/stats_test.go b/internal/stats/stats_test.go index 004e9513..f04bdf11 100644 --- a/internal/stats/stats_test.go +++ b/internal/stats/stats_test.go @@ -76,17 +76,19 @@ func TestStats(t *testing.T) { const respUpstream = "upstream" entries := []*stats.Entry{{ - Domain: reqDomain, - Client: cliIPStr, - Result: stats.RFiltered, - Time: time.Microsecond * 123456, - Upstream: respUpstream, + Domain: reqDomain, + Client: cliIPStr, + Result: stats.RFiltered, + ProcessingTime: time.Microsecond * 123456, + Upstream: respUpstream, + UpstreamTime: time.Microsecond * 222222, }, { - Domain: reqDomain, - Client: cliIPStr, - Result: stats.RNotFiltered, - Time: time.Microsecond * 123456, - Upstream: respUpstream, + Domain: reqDomain, + Client: cliIPStr, + Result: stats.RNotFiltered, + ProcessingTime: time.Microsecond * 123456, + Upstream: respUpstream, + UpstreamTime: time.Microsecond * 222222, }} wantData := &stats.StatsResp{ @@ -95,7 +97,7 @@ func TestStats(t *testing.T) { TopClients: []map[string]uint64{0: {cliIPStr: 2}}, TopBlocked: []map[string]uint64{0: {reqDomain: 1}}, TopUpstreamsResponses: []map[string]uint64{0: {respUpstream: 2}}, - TopUpstreamsAvgTime: []map[string]float64{0: {respUpstream: 0.123456}}, + TopUpstreamsAvgTime: []map[string]float64{0: {respUpstream: 0.222222}}, DNSQueries: []uint64{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, @@ -196,10 +198,10 @@ func TestLargeNumbers(t *testing.T) { for i := 0; i < cliNumPerHour; i++ { ip := net.IP{127, 0, byte((i & 0xff00) >> 8), byte(i & 0xff)} e := &stats.Entry{ - Domain: fmt.Sprintf("domain%d.hour%d", i, h), - Client: ip.String(), - Result: stats.RNotFiltered, - Time: 123456, + Domain: fmt.Sprintf("domain%d.hour%d", i, h), + Client: ip.String(), + Result: stats.RNotFiltered, + ProcessingTime: 123456, } s.Update(e) } diff --git a/internal/stats/unit.go b/internal/stats/unit.go index 60481d15..84c6770b 100644 --- a/internal/stats/unit.go +++ b/internal/stats/unit.go @@ -68,8 +68,12 @@ type Entry struct { // Result is the result of processing the request. Result Result - // Time is the duration of the request processing. - Time time.Duration + // ProcessingTime is the duration of the request processing from the start + // of the request including timeouts. + ProcessingTime time.Duration + + // UpstreamTime is the duration of the successful request to the upstream. + UpstreamTime time.Duration } // validate returns an error if entry is not valid. @@ -103,8 +107,8 @@ type unit struct { // upstreamsResponses stores the number of responses from each upstream. upstreamsResponses map[string]uint64 - // upstreamsTimeSum stores the sum of processing time in microseconds of - // responses from each upstream. + // upstreamsTimeSum stores the sum of durations of successful queries in + // microseconds to each upstream. upstreamsTimeSum map[string]uint64 // nResult stores the number of requests grouped by it's result. @@ -323,13 +327,14 @@ func (u *unit) add(e *Entry) { } u.clients[e.Client]++ - t := uint64(e.Time.Microseconds()) - u.timeSum += t + pt := uint64(e.ProcessingTime.Microseconds()) + u.timeSum += pt u.nTotal++ if e.Upstream != "" { u.upstreamsResponses[e.Upstream]++ - u.upstreamsTimeSum[e.Upstream] += t + ut := uint64(e.UpstreamTime.Microseconds()) + u.upstreamsTimeSum[e.Upstream] += ut } } diff --git a/scripts/make/go-lint.sh b/scripts/make/go-lint.sh index 737f8dc4..1ba1e9d9 100644 --- a/scripts/make/go-lint.sh +++ b/scripts/make/go-lint.sh @@ -35,7 +35,7 @@ set -f -u go_version="$( "${GO:-go}" version )" readonly go_version -go_min_version='go1.20.10' +go_min_version='go1.20.11' go_version_msg=" warning: your go version (${go_version}) is different from the recommended minimal one (${go_min_version}). if you have the version installed, please set the GO environment variable.