Skip to content

Commit

Permalink
Track memory used by DoH buffers (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgporada authored Jan 30, 2024
1 parent e284f50 commit ab17c00
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
9 changes: 8 additions & 1 deletion integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ func TestIntegration(t *testing.T) {
}

// 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 {
t.Errorf("Expected metric is missing: %s", metric)
}
Expand Down
11 changes: 8 additions & 3 deletions unbound_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ var (
"^num\\.query\\.tls\\.resume$"),
newUnboundMetric(
"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,
nil,
"^num\\.query\\.https$"),
Expand Down Expand Up @@ -325,8 +325,13 @@ var (
"Total number of triggered Response Policy Zone actions, by type.",
prometheus.CounterValue,
[]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+)$"),
}
)

Expand Down

0 comments on commit ab17c00

Please sign in to comment.