iroh_dns_server/metrics.rs
1//! Metrics exposed by the server.
2
3use iroh_metrics::{Counter, Gauge, MetricsGroup};
4
5/// Counters exposed by iroh-dns-server.
6#[derive(Debug, Default, MetricsGroup)]
7#[metrics(name = "dns_server")]
8#[non_exhaustive]
9pub struct Metrics {
10 /// Number of pkarr relay puts that updated the stored packet.
11 pub pkarr_publish_update: Counter,
12 /// Number of pkarr relay puts that did not change the stored packet.
13 pub pkarr_publish_noop: Counter,
14 /// Total number of DNS requests across all transports.
15 pub dns_requests: Counter,
16 /// Number of DNS requests received over UDP.
17 pub dns_requests_udp: Counter,
18 /// Number of DNS requests received over HTTPS (DoH).
19 pub dns_requests_https: Counter,
20 /// Number of DNS lookups that returned at least one answer.
21 pub dns_lookup_success: Counter,
22 /// Number of DNS lookups that returned no answers.
23 pub dns_lookup_notfound: Counter,
24 /// Number of DNS lookups that failed with an error.
25 pub dns_lookup_error: Counter,
26 /// Number of HTTP requests served.
27 pub http_requests: Counter,
28 /// Number of HTTP requests that returned a 2xx status code.
29 pub http_requests_success: Counter,
30 /// Number of HTTP requests that returned a non-2xx status code.
31 pub http_requests_error: Counter,
32 /// Cumulative duration of all HTTP requests, in milliseconds.
33 pub http_requests_duration_ms: Counter,
34 /// Number of signed packets newly inserted into the store.
35 pub store_packets_inserted: Counter,
36 /// Number of signed packets removed from the store.
37 ///
38 /// Currently always at 0 because the removal API is not used.
39 pub store_packets_removed: Counter,
40 /// Number of times an existing signed packet was replaced by a newer one.
41 pub store_packets_updated: Counter,
42 /// Number of signed packets removed by the eviction task.
43 pub store_packets_expired: Counter,
44 /// Current number of zones in the main cache
45 pub cache_zones: Gauge,
46 /// Current number of zones in the DHT cache
47 pub cache_zones_dht: Gauge,
48}