Skip to content

Commit

Permalink
Remove stats resolver (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xERR0R committed Sep 13, 2021
1 parent 02c4a05 commit 43bd568
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 700 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ Blocky is a DNS proxy and ad-blocker for the local network written in Go with fo
* [Prometheus](https://prometheus.io/) metrics
* Prepared [Grafana](https://grafana.com/) dashboards (Prometheus and database)
* Logging of DNS queries per day / per client in CSV format or MySQL/MariaDB database - easy to analyze
* Statistics report via CLI
* Various REST API endpoints
* CLI tool

Expand Down
131 changes: 0 additions & 131 deletions docs/additional_information.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ To print runtime configuration / statistics, you can send `SIGUSR1` signal to ru
INFO server: logDir= "/logs"
INFO server: perClient = false
INFO server: logRetentionDays= 7
INFO server: -> resolver: 'StatsResolver'
INFO server: stats:
INFO server: - Top 20 queries
INFO server: - Top 20 blocked queries
INFO server: - Query count per client
INFO server: - Reason
INFO server: - Query type
INFO server: - Response type
INFO server: -> resolver: 'MetricsResolver'
INFO server: metrics:
INFO server: Enable = true
Expand All @@ -48,129 +40,6 @@ To print runtime configuration / statistics, you can send `SIGUSR1` signal to ru

To send a signal to a process you can use `kill -s USR1 <PID>` or `docker kill -s SIGUSR1 blocky` for docker setup

## Statistics

blocky collects statistics and aggregates them hourly. If signal `SIGUSR2` is received, this will print statistics for
last 24 hours:

* Top 20 queried domains
* Top 20 blocked domains
* Query count per client ...

!!! summary

Example output:

```
INFO stats_resolver: ******* STATS 24h *******
INFO stats_resolver: ┌───────────────────────────────────────────────────────────┐
INFO stats_resolver: │ Top 20 queries │
INFO stats_resolver: ├────────────────────────────────────────────────────┬──────┤
INFO stats_resolver: │ 123.fritz.box │ 5760 │
INFO stats_resolver: │ checkip.12344567.com │ 1431 │
INFO stats_resolver: │ wpad.fritz.box │ 379 │
INFO stats_resolver: │ raw.githubusercontent.com │ 299 │
INFO stats_resolver: │ grafana.com │ 288 │
INFO stats_resolver: │ www.google.com │ 224 │
INFO stats_resolver: │ www.youtube.com │ 193 │
INFO stats_resolver: │ www.googleapis.com │ 169 │
INFO stats_resolver: │ fritz.box │ 156 │
INFO stats_resolver: │ incoming.telemetry.mozilla.org │ 148 │
INFO stats_resolver: │ android.googleapis.com │ 114 │
INFO stats_resolver: │ userlocation.googleapis.com │ 101 │
INFO stats_resolver: │ play.googleapis.com │ 100 │
INFO stats_resolver: │ safebrowsing.googleapis.com │ 97 │
INFO stats_resolver: │ api-mifitsdfsdfsdfi.com │ 84 │
INFO stats_resolver: │ connectivitycheck.gstatic.com │ 75 │
INFO stats_resolver: │ fonts.gstatic.com │ 66 │
INFO stats_resolver: │ i.ytimg.com │ 62 │
INFO stats_resolver: │ android.clients.google.com │ 55 │
INFO stats_resolver: │ play.google.com │ 50 │
INFO stats_resolver: └────────────────────────────────────────────────────┴──────┘
INFO stats_resolver: ┌──────────────────────────────────────────────────────────┐
INFO stats_resolver: │ Top 20 blocked queries │
INFO stats_resolver: ├────────────────────────────────────────────────────┬─────┤
INFO stats_resolver: │ incoming.telemetry.mozilla.org │ 148 │
INFO stats_resolver: │ googleads.g.doubleclick.net │ 47 │
INFO stats_resolver: │ data.mistat.intl.xiaomi.com │ 29 │
INFO stats_resolver: │ ssl.google-analytics.com │ 25 │
INFO stats_resolver: │ app-measurement.com │ 25 │
INFO stats_resolver: │ www.googletagmanager.com │ 24 │
INFO stats_resolver: │ www.googleadservices.com │ 23 │
INFO stats_resolver: │ privatestats.whatsapp.net │ 22 │
INFO stats_resolver: │ find.api.micloud.xiaomi.net │ 21 │
INFO stats_resolver: │ sdkconfig.ad.intl.xiaomi.com │ 18 │
INFO stats_resolver: │ sessionssdfsdfasdfam │ 16 │
INFO stats_resolver: │ pagead2.googlesyndication.com │ 16 │
INFO stats_resolver: │ firebase-settings.crashlytics.com │ 16 │
INFO stats_resolver: │ abroad.apilocate.amap.com │ 16 │
INFO stats_resolver: │ www.google-analytics.com │ 15 │
INFO stats_resolver: │ tracking.intl.miui.com │ 15 │
INFO stats_resolver: │ resolver.asdfsadfsdfsdfsdfsdfd │ 14 │
INFO stats_resolver: │ adfgdfgsfgdg │ 14 │
INFO stats_resolver: │ adservice.google.com │ 14 │
INFO stats_resolver: │ www.tns-cdfgffgdfg │ 12 │
INFO stats_resolver: └────────────────────────────────────────────────────┴─────┘
INFO stats_resolver: ┌───────────────────────────────────────────────────────────┐
INFO stats_resolver: │ Query count per client │
INFO stats_resolver: ├────────────────────────────────────────────────────┬──────┤
INFO stats_resolver: │ sdf.fritz.box │ 6338 │
INFO stats_resolver: │ dfdgsfgsfg.fritz.box │ 2075 │
INFO stats_resolver: │ df.fritz.box │ 1484 │
INFO stats_resolver: │ sdfgsdfg.fritz.box │ 1129 │
INFO stats_resolver: │ Android-3.fritz.box │ 1007 │
INFO stats_resolver: │ dfgsdfgsdfgsdf.fritz.box │ 956 │
INFO stats_resolver: │ 172.20.0.2 │ 833 │
INFO stats_resolver: │ 345345354353453iNote.fritz.box │ 393 │
INFO stats_resolver: │ R334534545-D.fritz.box │ 359 │
INFO stats_resolver: │ Android-2.fritz.box │ 347 │
INFO stats_resolver: │ Android.fritz.box │ 317 │
INFO stats_resolver: │ wererrw-TV.fritz.box │ 244 │
INFO stats_resolver: │ dfsdf-dfsddsdfsdf.fritz.box │ 77 │
INFO stats_resolver: │ sdfdf.fritz.box │ 18 │
INFO stats_resolver: │ sdfsdffsd.fritz.box │ 10 │
INFO stats_resolver: │ android-936072d2983c456a.fritz.box │ 8 │
INFO stats_resolver: └────────────────────────────────────────────────────┴──────┘
INFO stats_resolver: ┌───────────────────────────────────────────────────────────┐
INFO stats_resolver: │ Reason │
INFO stats_resolver: ├────────────────────────────────────────────────────┬──────┤
INFO stats_resolver: │ CONDITIONAL │ 6518 │
INFO stats_resolver: │ CACHED │ 5431 │
INFO stats_resolver: │ BLOCKED (ads) │ 1104 │
INFO stats_resolver: │ RESOLVED (1.1.1.1:53) │ 928 │
INFO stats_resolver: │ RESOLVED (9.9.9.9:53) │ 630 │
INFO stats_resolver: │ RESOLVED (80.241.218.68:53) │ 374 │
INFO stats_resolver: │ RESOLVED (89.233.43.71:53) │ 277 │
INFO stats_resolver: │ RESOLVED (46.182.19.48:53) │ 177 │
INFO stats_resolver: │ RESOLVED (91.239.100.100:53) │ 77 │
INFO stats_resolver: │ CUSTOM DNS │ 39 │
INFO stats_resolver: │ BLOCKED (kids) │ 14 │
INFO stats_resolver: │ BLOCKED IP (ads) │ 9 │
INFO stats_resolver: │ CACHED NEGATIVE │ 8 │
INFO stats_resolver: │ BLOCKED CNAME (ads) │ 7 │
INFO stats_resolver: └────────────────────────────────────────────────────┴──────┘
INFO stats_resolver: ┌───────────────────────────────────────────────────────────┐
INFO stats_resolver: │ Query type │
INFO stats_resolver: ├────────────────────────────────────────────────────┬──────┤
INFO stats_resolver: │ A │ 8206 │
INFO stats_resolver: │ AAAA │ 7330 │
INFO stats_resolver: │ SRV │ 44 │
INFO stats_resolver: │ NAPTR │ 15 │
INFO stats_resolver: └────────────────────────────────────────────────────┴──────┘
INFO stats_resolver: ┌────────────────────────────────────────────────────────────┐
INFO stats_resolver: │ Response type │
INFO stats_resolver: ├────────────────────────────────────────────────────┬───────┤
INFO stats_resolver: │ NOERROR │ 15368 │
INFO stats_resolver: │ NXDOMAIN │ 222 │
INFO stats_resolver: │ SERVFAIL │ 5 │
INFO stats_resolver: └────────────────────────────────────────────────────┴───────┘

```

!!! hint

To send a signal to a process you can use `kill -s USR2 <PID>` or `docker kill -s SIGUSR2 blocky` for docker setup

## Debug / Profiling

If http listener is enabled, [pprof](https://golang.org/pkg/net/http/pprof/) endpoint (`/debug/pprof`) is enabled
Expand Down
11 changes: 5 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@ Blocky is a DNS proxy and ad-blocker for the local network written in Go with fo

- **Integration** - :notebook_with_decorative_cover: various integration

* [Prometheus](https://prometheus.io/) metrics
* Prepared [Grafana](https://grafana.com/) dashboard
* Logging of DNS queries per day / per client in CSV format - easy to analyze
* Statistics report via CLI
* Various REST API endpoints
* CLI tool
* [Prometheus](https://prometheus.io/) metrics
* Prepared [Grafana](https://grafana.com/) dashboards (Prometheus and database)
* Logging of DNS queries per day / per client in CSV format or MySQL/MariaDB database - easy to analyze
* Various REST API endpoints
* CLI tool

- **Simple configuration** - :baby: single configuration file in YAML format

Expand Down
9 changes: 0 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ require (
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef
github.com/go-chi/chi v4.1.2+incompatible
github.com/go-chi/cors v1.2.0
github.com/go-openapi/strfmt v0.19.4 // indirect
github.com/jedib0t/go-pretty v4.3.0+incompatible
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/miekg/dns v1.1.43
github.com/mroth/weightedrand v0.4.1
Expand All @@ -34,20 +31,16 @@ require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-openapi/errors v0.19.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/spec v0.20.3 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.2 // indirect
Expand All @@ -56,15 +49,13 @@ require (
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-sqlite3 v1.14.8 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.2.0 // indirect
go.mongodb.org/mongo-driver v1.0.3 // indirect
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
Expand Down
Loading

0 comments on commit 43bd568

Please sign in to comment.