Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaner BPF debug logic #54

Merged
merged 3 commits into from
Apr 17, 2023
Merged

Leaner BPF debug logic #54

merged 3 commits into from
Apr 17, 2023

Conversation

grcevski
Copy link
Contributor

@grcevski grcevski commented Apr 13, 2023

We may need to debug the bpf side of things in the field or for our purposes while developing, so we had a mechanism to set the debug level on the bpf side after loading, plus a few macros to support logging levels.

As recently seen in a GitHub actions platform bug, having unnecessary ifs lying around may be problematic for older kernels.

With this change I'm changing how bpf debug printing works in the following way:

  • Enablement of debug printing at bpf time is supported by an ifdef macro
  • New bpf2go command builds a debug version of the bpf module to be loaded
  • At instrumentation load time, if BPF_DEBUG is set to 1 (or TRUE) while launching, we load the debug version of the bpf program. Otherwise we load the non-debug version which has all print statement stripped out, except those that mean errors in what we are reading.

Based on #50, we need that merged first before we review this.

@grcevski grcevski self-assigned this Apr 13, 2023
@grcevski grcevski requested a review from mariomac April 14, 2023 14:45
@grcevski grcevski merged commit 10ae310 into grafana:main Apr 17, 2023
2 checks passed
@grcevski grcevski deleted the leaner_debug branch April 17, 2023 12:59
@grcevski
Copy link
Contributor Author

Thanks Mario!

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.

None yet

2 participants