You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/prometheus_grafana.md
+34-2Lines changed: 34 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ Following metrics will be exported:
17
17
| blocky_query_total | Counter of total queries, partitioned by client and DNS request type (A, AAAA, PTR, etc) |
18
18
| blocky_request_duration_seconds | Histogram of request duration, partitioned by response type (Blocked, cached, etc) |
19
19
| blocky_response_total | Counter of responses, partitioned by response type (Blocked, cached, etc), DNS response code, and reason |
20
-
| blocky_client_response_total | Counter of responses, partitioned by client and response type (Blocked, cached, etc) |
20
+
| blocky_client_response_total | Counter of query outcomes, partitioned by client and response type (Blocked, cached, etc); failed requests are counted as `response_type="err"`|
21
21
| blocky_blocking_enabled | Boolean 1 if blocking is enabled, 0 otherwise |
22
22
| blocky_cache_entries | Gauge of entries in cache |
23
23
| blocky_cache_hits_total | Counter of the number of cache hits |
@@ -40,7 +40,7 @@ Following metrics will be exported:
40
40
41
41
To keep the `reason` label of `blocky_response_total` bounded, blocked responses use the matched
42
42
group names only (e.g. `BLOCKED (ads)`), **not** the matched rule. The full reason including the
43
-
matched rule (e.g. `BLOCKED (ads: *.docler.com)`) is still available in the [query log](configuration.md#query-log).
43
+
matched rule (e.g. `BLOCKED (ads: *.docler.com)`) is still available in the [query log](configuration.md#query-logging).
44
44
This avoids unbounded metric cardinality when large deny lists are used.
45
45
46
46
!!! note "`client` label cardinality"
@@ -52,6 +52,38 @@ Following metrics will be exported:
52
52
the set of `client` label values can grow effectively unbounded over time. Consider this before
53
53
scraping/retaining these metrics on such networks.
54
54
55
+
Blocky has no option to drop the label yet, so the mitigation is on the Prometheus side: drop the
56
+
affected metrics at scrape time when you do not need the per-client breakdown.
57
+
58
+
```yaml
59
+
metric_relabel_configs:
60
+
- source_labels: [__name__]
61
+
regex: "blocky_(query|client_response)_total"
62
+
action: drop
63
+
```
64
+
65
+
Dropping only the `client` label (`labeldrop`) does **not** work: the remaining series of the
66
+
different clients collapse into one, and Prometheus rejects the scrape with a duplicate-sample
67
+
error.
68
+
69
+
!!! note "`response_type` values of `blocky_client_response_total`"
70
+
71
+
The counter is incremented once per query that reaches the metrics resolver, so it sums to
72
+
`blocky_query_total` rather than to `blocky_response_total` — the latter counts only successful
73
+
responses. Requests that produced no response at all are recorded as `response_type="err"`, which
74
+
is not one of the regular response types.
75
+
76
+
`FILTERED` and `NOTFQDN` never appear: the `filtering` and `fqdnOnly` resolvers answer those
77
+
queries above the metrics resolver in the chain, so they are missing from `blocky_query_total`,
78
+
`blocky_response_total` and `blocky_request_duration_seconds` as well. The query log sits below
79
+
them in the chain too, so those queries are only visible in the [statistics](configuration.md#statistics).
80
+
81
+
Example — per-client rate of queries that were actually resolved rather than blocked:
82
+
83
+
```promql
84
+
sum by (client) (rate(blocky_client_response_total{response_type!~"BLOCKED|REBIND|err"}[5m]))
0 commit comments