Skip to content

Add http debug listener#57

Merged
mcpherrinm merged 8 commits into
mainfrom
mattm-debug-listen
Apr 9, 2026
Merged

Add http debug listener#57
mcpherrinm merged 8 commits into
mainfrom
mattm-debug-listen

Conversation

@mcpherrinm

@mcpherrinm mcpherrinm commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

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

Has both metrics and pprof endpoints
Add basic integration test that checks there's something available
Copilot AI review requested due to automatic review settings April 8, 2026 17:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.New to create a Prometheus registry and (optionally) start a debug HTTP server exposing /metrics and /debug/pprof/*.
  • Threads a prometheus.Registerer through main -> server.Run -> newHandler and 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.

Comment thread stats/stats.go Outdated
Comment thread server/page.go
Comment thread server/page_test.go
Comment thread config/config.go
Comment thread stats/stats.go
@mcpherrinm mcpherrinm merged commit ee86b4a into main Apr 9, 2026
2 checks passed
@mcpherrinm mcpherrinm deleted the mattm-debug-listen branch April 9, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants