Add http debug listener#57
Merged
Merged
Conversation
Has both metrics and pprof endpoints
Add basic integration test that checks there's something available
There was a problem hiding this comment.
Pull request overview
Adds an optional debug HTTP listener to expose Prometheus metrics and pprof endpoints, and wires a shared Prometheus registry into the main HTTPS handler to record HTTP request metrics.
Changes:
- Introduces
stats.Newto create a Prometheus registry and (optionally) start a debug HTTP server exposing/metricsand/debug/pprof/*. - Threads a
prometheus.Registererthroughmain -> server.Run -> newHandlerand instruments the main handler with an HTTP requests counter. - Extends config/test and integration assets to include
debugAddr, and adds an integration check for/metrics.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
stats/stats.go |
New stats/debug server with Prometheus registry + pprof and /metrics endpoints. |
server/server.go |
Passes Prometheus registry into handler construction. |
server/page.go |
Instruments the main HTTPS handler with a Prometheus HTTP requests counter. |
server/page_test.go |
Updates handler types/calls for the new newHandler signature. |
main.go |
Creates the registry/debug server and passes registry into server.Run. |
config/config.go |
Adds DebugAddr to configuration schema. |
config/config_test.go |
Updates expected config to include DebugAddr. |
config/testdata/test.json |
Adds debugAddr to test config fixture. |
integration/test-certs-site-config.json |
Adds debugAddr for integration environment. |
integration/integration_test.go |
Adds a /metrics reachability check. |
docker-compose.yml |
Exposes debug port 9001 for local integration. |
go.mod / go.sum |
Adds Prometheus client deps and updates indirect deps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lenaunderwood22
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a debugAddr config, with the address to listen for metrics and pprof. This code is modelled after Boulder's newStatsRegistry.
This just registers basic go stats as well as the promhttp stats. We want to add more stats in the future, but this seemed like a good starting point.
The integration test just check that metrics is reachable and has an expected substring.
Part of #51