Skip to content

feat: optional pprof endpoints via pprof_enabled - #1056

Open
alexluong wants to merge 1 commit into
mainfrom
feat/pprof-endpoint
Open

feat: optional pprof endpoints via pprof_enabled#1056
alexluong wants to merge 1 commit into
mainfrom
feat/pprof-endpoint

Conversation

@alexluong

Copy link
Copy Markdown
Collaborator

Adds pprof_enabled / PPROF_ENABLED (default off). When set, net/http/pprof is mounted under /debug/pprof/ on the service HTTP port, for every service type — so a delivery or log worker can be profiled in place, not just the API.

The handlers are unauthenticated, so this is strictly opt-in and meant for ports that aren't publicly reachable.

PPROF_ENABLED=true ./outpost   # or pprof_enabled: true in config
go tool pprof http://localhost:3333/debug/pprof/profile?seconds=30
go tool pprof http://localhost:3333/debug/pprof/heap

🤖 Generated with Claude Code

https://claude.ai/code/session_011ox7wgp77JimQcPkV3LDa1

Mounts net/http/pprof under /debug/pprof/ on the service HTTP port for
every service type when enabled. Off by default; the handlers are
unauthenticated.

@alexbouchardd alexbouchardd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do that need to be documented seems oddly specific, who is that helpful for?

@alexluong

Copy link
Copy Markdown
Collaborator Author

Do that need to be documented seems oddly specific, who is that helpful for?

Sorry, I don't follow. Are you talking about the config documentation? We can certainly keep it shorter if that's the comment.

@alexbouchardd

alexbouchardd commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

I don't understand who this flag is for and in which context, which I imagine most people reading the config doc wouldn't either

@alexluong

Copy link
Copy Markdown
Collaborator Author

I don't believe this flag is documented in the config doc. The PR doesn't edit any markdown file, and we don't generate config doc from code anymore.

As for what this flag is, it's to enabled Golang's pprof which is a profiler. Every time I need to profile, I would have to add this snippet, build a new image, deploy, and then I can start profiling. With this PR, I can add a flag and it's good to go.

This is the 2nd or 3rd time that I've needed this so figured it would be a good addition.

Also it's a common-ish practice AFAIK, for example: elastic/apm-server#8002

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.

2 participants