feat: add pprof profiling support to interlink, virtual-kubelet, and ssh-tunnel components#534
feat: add pprof profiling support to interlink, virtual-kubelet, and ssh-tunnel components#534ShantKhatri wants to merge 2 commits into
Conversation
…ssh-tunnel components Signed-off-by: Prashantkumar Khatri <khatri2105104@st.jmi.ac.in>
✅ Deploy Preview for interlink-dev canceled.
|
There was a problem hiding this comment.
Pull request overview
This PR introduces basic Go pprof HTTP profiling support across the long-running interLink components (interlink, virtual-kubelet, ssh-tunnel) by adding a shared helper and wiring it into each component with config/flag/env-based enablement.
Changes:
- Added a shared
pkg/pprofhelper that starts a backgroundnet/http/pprofserver tied to a context. - Extended interlink and virtual-kubelet YAML configs with a
Pprofblock (and added env-var overrides for interlink; env-var overrides are applied in vk main). - Added CLI flags + env-var overrides to enable/parameterize pprof for
ssh-tunnel, plus unit tests forpkg/pprof.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/virtualkubelet/config.go | Adds PprofConfig and embeds it in the VK config struct for YAML-driven pprof settings. |
| pkg/pprof/pprof.go | Introduces the shared pprof server starter helper. |
| pkg/pprof/pprof_test.go | Adds tests to validate pprof server start/disabled behavior. |
| pkg/interlink/config.go | Adds PprofConfig and supports env-var overrides in interlink config loading. |
| cmd/virtual-kubelet/main.go | Wires pprof startup into virtual-kubelet with YAML + env-var overrides and default values. |
| cmd/ssh-tunnel/main.go | Adds pprof CLI flags, env-var overrides, and starts the pprof server. |
| cmd/interlink/main.go | Starts the pprof server based on loaded config defaults/overrides. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… and updated address parsing Signed-off-by: Prashantkumar Khatri <khatri2105104@st.jmi.ac.in>
a16c72b to
31b8d50
Compare
|
Hi @dciangot, changes here are ready for review when you get a chance.
|
Fixes #400
Summary
This PR adds basic pprof profiling to all three long-running components,
interlink,virtual-kubelet, andssh-tunnel,as a starting point for #400 .The approach is intentionally simple is as a shared
pkg/pprofhelper spins up a background HTTP server that exposes Go's standard/debug/pprof/endpoints. This usesnet/http/pprof(the HTTP wrapper aroundruntime/pprof) which is the lowest-friction way to get profiling working without touching existing server code.Profiling is off by default. Each component can opt in via:
Pprof:block in the YAML config (for interlink and virtual-kubelet)-pprof, -pprof-port, -pprof-address(for ssh-tunnel)ENABLE_PPROF, PPROF_PORT, PPROF_ADDRESS(all three)Default ports are
6060(vk),6061(interlink),6062(ssh-tunnel) to avoid conflicts when running everything on the same host.This is intentionally the "easy first step". Down the line we could look at file-based
runtime/pprofcaptures for scheduled/offline profiling, or auth-gating the endpoints for production hardening, but those feel like follow-ups once we've validated the basics work.Related issue : #400