| 1 |
.\" Generated by Mmark Markdown Processor - mmark.miek.nl |
| 2 |
.TH "METRICS" 7 "August 2026" "atomdns handlers" "atomdns authors" |
| 3 |
|
| 4 |
.SH "NAME" |
| 5 |
.PP |
| 6 |
\fImetrics\fP \- enable prometheus |
| 7 |
\[la]https://prometheus.io/\[ra] metrics |
| 8 |
|
| 9 |
.SH "DESCRIPTION" |
| 10 |
.PP |
| 11 |
With \fImetrics\fP metrics are exported from atomdns and any handler that adds extra ones. |
| 12 |
The default address for the metrics server is \fB\fClocalhost:9153\fR. The metrics path is fixed to \fB\fC/metrics\fR. |
| 13 |
See the \fIglobal\fP handler for details on how to change the address, and other properties. |
| 14 |
|
| 15 |
.PP |
| 16 |
You must also enable metrics in the handler block, this allows you to specify where in the handler chain the |
| 17 |
metrics are gathered. Usually this is the first handler. If the global block doesn't specify \fImetrics\fP the |
| 18 |
metrics will not be able to be scraped, but they are still gathered. |
| 19 |
|
| 20 |
.PP |
| 21 |
Enabling metrics means taking a (severe) performance hit (50 Kqps, seen in [limited] testing), to alleviate |
| 22 |
this, by default, only 1 in 10 queries will be monitored. See the \fIglobal\fP handler's documentation on how to change this. |
| 23 |
When displaying these metrics in (e.g.) Grafana, be sure to *10, otherwise your queries per second is lower |
| 24 |
then you hoped for. Other handlers that use metrics on a per\-query basis also adhere to this limit, for |
| 25 |
instance the \fIacl\fP handler gathers one in \fB\fCN\fR. |
| 26 |
|
| 27 |
.PP |
| 28 |
In addition to the default Go metrics exported by the prometheus Go |
| 29 |
client |
| 30 |
\[la]https://prometheus.io/docs/guides/go-application/\[ra], the following metrics are exported: |
| 31 |
|
| 32 |
.IP \(bu 4 |
| 33 |
\fB\fCatomdns_dns_dropped_total{}\fR \- total count of dropped queries, because they are invalid, these will always |
| 34 |
be reported even with \fB\fCmetrics disable\fR, as this happens before the query hits this handler. |
| 35 |
.IP \(bu 4 |
| 36 |
\fB\fCatomdns_dns_requests_total{zone, network, family, flags}\fR \- total query count. |
| 37 |
.IP \(bu 4 |
| 38 |
\fB\fCatomdns_dns_responses_total{zone, network, family, rcode}\fR \- response per, among other things, the response code. |
| 39 |
.IP \(bu 4 |
| 40 |
\fB\fCatomdns_dns_request_duration_seconds{zone, network, family}\fR \- duration to process each query. |
| 41 |
.IP \(bu 4 |
| 42 |
\fB\fCatomdns_dns_request_size_bytes{zone, network, family}\fR \- size of the request in bytes. |
| 43 |
.IP \(bu 4 |
| 44 |
\fB\fCatomdns_dns_response_size_bytes{zone, network, family}\fR \- response size in bytes. |
| 45 |
.IP \(bu 4 |
| 46 |
\fB\fCnetwork\fR which holds the transport of the response ("udp" or "tcp") |
| 47 |
.IP \(bu 4 |
| 48 |
The address family (\fB\fCfamily\fR) of the transport (1 = IP (IP version 4), 2 = IP6 (IP version 6)). |
| 49 |
.IP \(bu 4 |
| 50 |
\fB\fCflags\fR is a string that consists out of header flags mnemonics seperated by spaces: |
| 51 |
|
| 52 |
.RS |
| 53 |
.IP \(en 4 |
| 54 |
\fB\fCflags="co do"\fR means the CO (compact answers) and DO (dnssec ok) are set. |
| 55 |
.IP \(en 4 |
| 56 |
The recognized flags are: co \- compact answers, do \- dnssec ok, de \- deleg ok, ad \- authenticated data, |
| 57 |
and cd \- checking disabled. |
| 58 |
|
| 59 |
.RE |
| 60 |
|
| 61 |
|
| 62 |
.PP |
| 63 |
If a server want to not partake in the metrics collection it sets \fB\fCmetrics disable\fR in the configuration. The default is |
| 64 |
to allow metrics gathering. |
| 65 |
|
| 66 |
.SH "SYNTAX" |
| 67 |
.PP |
| 68 |
.RS |
| 69 |
|
| 70 |
.nf |
| 71 |
metrics [|enable|disable] |
| 72 |
|
| 73 |
.fi |
| 74 |
.RE |
| 75 |
|
| 76 |
.PP |
| 77 |
Where: |
| 78 |
|
| 79 |
.IP \(bu 4 |
| 80 |
\fIempty\fP or \fB\fCenable\fR will enable metrics gathering, only \fB\fCdisable\fR will disable it. |
| 81 |
|
| 82 |
|
| 83 |
.SH "EXAMPLES" |
| 84 |
.PP |
| 85 |
Start a server on the default port and load the \fIwhoami\fP handler and disable metrics. |
| 86 |
|
| 87 |
.PP |
| 88 |
.RS |
| 89 |
|
| 90 |
.nf |
| 91 |
{ |
| 92 |
metrics |
| 93 |
debug |
| 94 |
} |
| 95 |
|
| 96 |
example.org { |
| 97 |
metrics disable |
| 98 |
whoami |
| 99 |
} |
| 100 |
|
| 101 |
.fi |
| 102 |
.RE |
| 103 |
|
| 104 |
.PP |
| 105 |
To scrape metrics with prometheus you need something like this in the main \fB\fCprometheus.yaml\fR configuration |
| 106 |
file: |
| 107 |
|
| 108 |
.PP |
| 109 |
.RS |
| 110 |
|
| 111 |
.nf |
| 112 |
global: |
| 113 |
scrape\_interval: 1m |
| 114 |
|
| 115 |
scrape\_configs: |
| 116 |
\- job\_name: atomdns |
| 117 |
static\_configs: |
| 118 |
\- targets: ["localhost:9153"] |
| 119 |
|
| 120 |
.fi |
| 121 |
.RE |
| 122 |
|
| 123 |
.SH "ALSO SEE" |
| 124 |
.PP |
| 125 |
Getting Started with Prometheus |
| 126 |
\[la]https://prometheus.io/docs/prometheus/latest/getting_started/\[ra]. |