Track memory used by DoH buffers (#72)

This commit is contained in:
Phil Porada 2024-01-30 10:17:11 -05:00 committed by GitHub
parent e284f508b4
commit ab17c00752
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 4 deletions

View File

@ -44,7 +44,14 @@ func TestIntegration(t *testing.T) {
} }
// Check some expected metrics are present // Check some expected metrics are present
for _, metric := range []string{"go_info", "unbound_queries_total", "unbound_response_time_seconds", "unbound_cache_hits_total"} { for _, metric := range []string{
"go_info",
"unbound_queries_total",
"unbound_response_time_seconds",
"unbound_cache_hits_total",
"unbound_query_https_total",
"unbound_memory_doh_bytes",
} {
if _, ok := metrics[metric]; !ok { if _, ok := metrics[metric]; !ok {
t.Errorf("Expected metric is missing: %s", metric) t.Errorf("Expected metric is missing: %s", metric)
} }

View File

@ -196,7 +196,7 @@ var (
"^num\\.query\\.tls\\.resume$"), "^num\\.query\\.tls\\.resume$"),
newUnboundMetric( newUnboundMetric(
"query_https_total", "query_https_total",
"Total number of queries that were made using HTTPS towards the Unbound server.", "Total number of DoH queries that were made towards the Unbound server.",
prometheus.CounterValue, prometheus.CounterValue,
nil, nil,
"^num\\.query\\.https$"), "^num\\.query\\.https$"),
@ -325,8 +325,13 @@ var (
"Total number of triggered Response Policy Zone actions, by type.", "Total number of triggered Response Policy Zone actions, by type.",
prometheus.CounterValue, prometheus.CounterValue,
[]string{"type"}, []string{"type"},
"^num\\.rpz\\.action\\.rpz-([\\w-]+)$", "^num\\.rpz\\.action\\.rpz-([\\w-]+)$"),
), newUnboundMetric(
"memory_doh_bytes",
"Memory used by DoH buffers, in bytes.",
prometheus.GaugeValue,
[]string{"buffer"},
"^mem\\.http\\.(\\w+)$"),
} }
) )