Skip to content

pkg/bugtool: avoid pprof logs without gops - #5329

Open
Ehtasham-Yasin wants to merge 3 commits into
cilium:mainfrom
Ehtasham-Yasin:pr/Ehtasham-Yasin/bugtool-gops-messages
Open

pkg/bugtool: avoid pprof logs without gops#5329
Ehtasham-Yasin wants to merge 3 commits into
cilium:mainfrom
Ehtasham-Yasin:pr/Ehtasham-Yasin/bugtool-gops-messages

Conversation

@Ehtasham-Yasin

Copy link
Copy Markdown

Fixes #5308

Description

Skip pprof collection when Tetragon has no gops address. This leaves the
single skip message from the existing gops collection path and prevents false
success messages for CPU and heap profiles.

Add a focused regression test for both reported log problems.

Checks:

  • go test ./pkg/bugtool -run '^TestGopsDisabledLogsOnce$' -count=1
  • Non-BPF bugtool unit tests
  • golangci-lint run ./pkg/bugtool/...
  • gofmt -d pkg/bugtool/bugtool.go pkg/bugtool/bugtool_test.go
  • git diff --check

The full go test ./pkg/bugtool command could not complete in the fresh
Linux container because the unrelated TestFindMaps/BaseSensorMemlock test
requires the generated bpf/objs/bpf_exit_v511.o object, which was not
present.

AI assistance: Codex was used for code-path analysis, the guard and regression
test, running checks, and PR preparation. The final diff and test results were
shown to the contributor for review before submission.

Changelog

Fix misleading pprof logs when bugtool runs without gops.

Skip pprof collection when no gops address is configured. This prevents
duplicate skip logs and false success messages.

Fixes: cilium#5308
Signed-off-by: Ehtasham-Yasin <ehtasham.yasin.dev@gmail.com>
@Ehtasham-Yasin
Ehtasham-Yasin requested a review from a team as a code owner July 23, 2026 15:04
@Ehtasham-Yasin
Ehtasham-Yasin requested a review from tpapagian July 23, 2026 15:04

@bar234 bar234 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.

Few comments

Comment thread pkg/bugtool/bugtool.go Outdated
Comment on lines 598 to 601

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.

This isn't needed anymore since this is checked in the caller

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done — removed the redundant check since it’s now handled by the caller. Thanks!

Comment thread pkg/bugtool/bugtool.go Outdated
Comment on lines 322 to 323

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.

What do you think about adding check for si.info.GopsAddr == "" here before calling si.addGopsInfo() and si.addPProfInfo()? This is the only place those functions are called and we can remove any extra checks for si.info.GopsAddr == "" within them (such as in addGopsInfo and getPProf)

You could also print the error message here too if the gops addr wasn't provided

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, that makes sense. I moved the GopsAddr == "" check to the caller before addGopsInfo() and addPProfInfo(), log the skip message there, and removed the redundant checks from the callees. Thanks for the suggestion.

Signed-off-by: Ehtasham-Yasin <ehtasham.yasin.dev@gmail.com>
@netlify

netlify Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit dc32bf4
🔍 Latest deploy log https://app.netlify.com/projects/tetragon/deploys/6a68d7f455195b00085a10ca
😎 Deploy Preview https://deploy-preview-5329--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@will-isovalent will-isovalent 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.

Hey, thanks for the PR. I really don't think we need a regression test for this. That seems like overkill. Could you drop the test? Then I think it should be good to merge.

@bar234 bar234 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.

Happy with the changes for my comments. I agree with @will-isovalent, we don't need the extra test case

Signed-off-by: Ehtasham-Yasin <ehtasham.yasin.dev@gmail.com>
@Ehtasham-Yasin

Copy link
Copy Markdown
Author

Thanks @will-isovalent and @bar234 — I removed TestGopsDisabledLogsOnce and its unused imports in 4371116. The production code is unchanged.

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.

bugtool: messages regarding gops

3 participants