[PR #3367] [MERGED] initial histogram metrics support, opp. enc. probe duration #3782

Closed
opened 2026-03-16 12:02:24 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/3367
Author: @cpu
Created: 11/27/2025
Status: Merged
Merged: 12/5/2025
Merged by: @cpu

Base: mainHead: cpu-histo-metrics_dev


📝 Commits (7)

  • 1afbf5b bin: rework named_metric_tests imports
  • 352825c bin: avoid fully-qualified imports in named_metrics_tests
  • 6798d95 bin: add opp. enc. metrics integration test
  • 1ebd60e resolver: correct opp. enc. budget for connection errs
  • 9905b86 bin: support histogram metrics in desc test
  • 2e71557 bin: configure Prometheus histogram buckets
  • abd0f20 resolver: track opp. enc. probe duration metric

📊 Changes

6 files changed (+309 additions, -50 deletions)

View changed files

bin/opp_enc_state.toml (+0 -0)
📝 bin/src/prometheus_server.rs (+5 -0)
📝 bin/tests/integration/config_tests.rs (+1 -1)
📝 bin/tests/integration/named_metrics_tests.rs (+115 -31)
📝 crates/resolver/src/name_server.rs (+76 -18)
tests/test-data/test_configs/example_recursor_opportunistic_enc_2.toml (+112 -0)

📄 Description

This branch adds an opportunistic encryption probe duration histogram metric. It's a follow-up from https://github.com/hickory-dns/hickory-dns/pull/3314 where I previously tried to add a histogram metric but ran into some trouble detailed in this comment thread.

Initially it looked to me like the only way to set the histogram buckets in hickory-dns was by matching by metric name, but we can instead set a global set of buckets and that seems more tractable for the time being. See the corresponding commit message for more detail.

Along the way I noticed and fixed a few things:

  1. I noticed the budget gauge value seemed incorrect after some local testing and caught that there was a failure codepath that missed some accounting. I fixed that and updated the unit test coverage.
  2. As described in the other thread the pre-existing test logic for determining if a metric has a description or not couldn't handle histogram metrics, and would incorrectly flag them as un-described when encountering the "sub"-metrics.

I'd like to follow-up on this change by adding a few more histogram metrics, but for now have limited myself to the one I wanted to start with in the area of the code I'm most familiar. Looking at the metrics offered by the unbound exporter being used by Let's Encrypt suggests at a minimum we might want histograms for query response time, and for recursive resolution processing time. Other suggestions welcome!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/3367 **Author:** [@cpu](https://github.com/cpu) **Created:** 11/27/2025 **Status:** ✅ Merged **Merged:** 12/5/2025 **Merged by:** [@cpu](https://github.com/cpu) **Base:** `main` ← **Head:** `cpu-histo-metrics_dev` --- ### 📝 Commits (7) - [`1afbf5b`](https://github.com/hickory-dns/hickory-dns/commit/1afbf5b754ea7f81cc0c2b343395f0a66167c1dd) bin: rework named_metric_tests imports - [`352825c`](https://github.com/hickory-dns/hickory-dns/commit/352825c4fc43257fbeeef5c04d2563996051d54e) bin: avoid fully-qualified imports in named_metrics_tests - [`6798d95`](https://github.com/hickory-dns/hickory-dns/commit/6798d95908b60abb5a60aa38bacb1997b7019070) bin: add opp. enc. metrics integration test - [`1ebd60e`](https://github.com/hickory-dns/hickory-dns/commit/1ebd60e497cd55c819cdfed55ee9533393d4f93a) resolver: correct opp. enc. budget for connection errs - [`9905b86`](https://github.com/hickory-dns/hickory-dns/commit/9905b864f3113fdf43e44d0ef7daa8beec9d8d98) bin: support histogram metrics in desc test - [`2e71557`](https://github.com/hickory-dns/hickory-dns/commit/2e71557ad07d691a0253d6ae7d66565fd095f463) bin: configure Prometheus histogram buckets - [`abd0f20`](https://github.com/hickory-dns/hickory-dns/commit/abd0f20427509b701364af4dbee32196cb035a1e) resolver: track opp. enc. probe duration metric ### 📊 Changes **6 files changed** (+309 additions, -50 deletions) <details> <summary>View changed files</summary> ➕ `bin/opp_enc_state.toml` (+0 -0) 📝 `bin/src/prometheus_server.rs` (+5 -0) 📝 `bin/tests/integration/config_tests.rs` (+1 -1) 📝 `bin/tests/integration/named_metrics_tests.rs` (+115 -31) 📝 `crates/resolver/src/name_server.rs` (+76 -18) ➕ `tests/test-data/test_configs/example_recursor_opportunistic_enc_2.toml` (+112 -0) </details> ### 📄 Description This branch adds an opportunistic encryption probe duration histogram metric. It's a follow-up from https://github.com/hickory-dns/hickory-dns/pull/3314 where I previously tried to add a histogram metric but ran into some trouble [detailed in this comment thread](https://github.com/hickory-dns/hickory-dns/pull/3314#discussion_r2437307499). Initially it looked to me like the only way to set the histogram buckets in `hickory-dns` was by matching by metric name, but we can instead set a global set of buckets and that seems more tractable for the time being. See the corresponding commit message for more detail. Along the way I noticed and fixed a few things: 1. I noticed the budget gauge value seemed incorrect after some local testing and caught that there was a failure codepath that missed some accounting. I fixed that and updated the unit test coverage. 2. As described in the [other thread](https://github.com/hickory-dns/hickory-dns/pull/3314#discussion_r2437307499) the pre-existing test logic for determining if a metric has a description or not couldn't handle histogram metrics, and would incorrectly flag them as un-described when encountering the "sub"-metrics. I'd like to follow-up on this change by adding a few more histogram metrics, but for now have limited myself to the one I wanted to start with in the area of the code I'm most familiar. Looking at the metrics offered by the [unbound exporter](https://github.com/letsencrypt/unbound_exporter/blob/e5bf497ac87f0cae910cb37f370a27e2dcfb85fa/exporter/unbound_exporter.go#L31-L450) being used by Let's Encrypt suggests at a minimum we might want histograms for query response time, and for recursive resolution processing time. Other suggestions welcome! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 12:02:24 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#3782
No description provided.