Skip to content

CHORE: Enable pprof based on env var#114

Merged
prasadlohakpure merged 1 commit into
mainfrom
chore/debug_pprof
Jul 2, 2026
Merged

CHORE: Enable pprof based on env var#114
prasadlohakpure merged 1 commit into
mainfrom
chore/debug_pprof

Conversation

@prasadlohakpure

@prasadlohakpure prasadlohakpure commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Description

This pull request updates dependencies in go.mod and adds a new debug profiling endpoint to the Heimdall service. The most important changes are grouped below:

Enable /debug/pprof/ endpoint based on env flag

Why

It would be useful for debugging certain stacktraces whenever required

Overheads added

  • CPU profiling (/debug/pprof/profile)
    Sampling frequency 100 Hz (every 10ms per OS thread)
    Overhead while active ~1–2% CPU (typical), up to ~5% on very high-throughput services

  • Memory / heap profiling (/debug/pprof/heap, /allocs)
    Sampling rate 1 sample per 512 KB allocated (MemProfileRate, default)
    Continuous overhead ~1–2% allocation-path cost — already present in every Go binary, pprof adds nothing

  • Goroutine profile (/debug/pprof/goroutine)
    For ~1,000 goroutines < 1 ms STW pause
    For ~10,000 ~1–10 ms STW pause

Execution trace (/debug/pprof/trace)
Overhead while active ~10–20% (can spike higher on scheduler-heavy workloads)

Copilot AI review requested due to automatic review settings July 1, 2026 15:47

Copilot AI 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.

Pull request overview

This PR adds an opt-in runtime profiling endpoint to the Heimdall HTTP server and runs a dependency tidy/update in Go modules to support the change and refresh transitive deps.

Changes:

  • Add /debug/pprof/ endpoint, enabled only when ENABLE_DEBUG=true.
  • Update go.mod/go.sum dependency set (adds/updates several indirect deps and adjusts AWS SDK service deps).

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/pkg/heimdall/heimdall.go Adds conditional registration of the /debug/pprof/ endpoint.
go.mod Updates module requirements (including adding/updating profiling-related and AWS SDK dependencies).
go.sum Updates dependency checksums to match go.mod changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/pkg/heimdall/heimdall.go
@prasadlohakpure prasadlohakpure requested a review from a team July 1, 2026 15:56
Comment thread go.sum
@prasadlohakpure prasadlohakpure merged commit 2809c08 into main Jul 2, 2026
8 checks passed
@prasadlohakpure prasadlohakpure deleted the chore/debug_pprof branch July 2, 2026 03:11
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.

4 participants