[GH-ISSUE #2947] Write separate HTTP server for Prometheus metrics scrapes #1097

Closed
opened 2026-03-16 01:36:10 +03:00 by kerem · 0 comments
Owner

Originally created by @divergentdave on GitHub (Apr 24, 2025).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2947

Originally assigned to: @divergentdave on GitHub.

#2900 adds a test that checks the output of the Prometheus exporter. The exporter crate we're using just takes in a socket address, and doesn't return the local address of the socket, so we can't bind to port 0 for this test. Instead we bind an ephemeral port, close it, and reuse that port number with the exporter. Based on past experience, this will introduce infrequent test flakes. The suggested approach for more advanced use cases is to implement our own HTTP server, and use the exporter crate to just render the metrics scrape into the Prometheus text format. This will let us write our own test utilities, and it will give us more flexibility in the future to tweak the Prometheus endpoint.

Originally created by @divergentdave on GitHub (Apr 24, 2025). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2947 Originally assigned to: @divergentdave on GitHub. #2900 adds a test that checks the output of the Prometheus exporter. The exporter crate we're using just takes in a socket address, and doesn't return the local address of the socket, so we can't bind to port 0 for this test. Instead we bind an ephemeral port, close it, and reuse that port number with the exporter. Based on past experience, this will introduce infrequent test flakes. The suggested approach for more advanced use cases is to implement our own HTTP server, and use the exporter crate to just render the metrics scrape into the Prometheus text format. This will let us write our own test utilities, and it will give us more flexibility in the future to tweak the Prometheus endpoint.
kerem closed this issue 2026-03-16 01:36:15 +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#1097
No description provided.