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

RFC: build the profiler with both release and debug tracers by default #232

Open
tsint opened this issue Nov 8, 2024 · 1 comment
Open

Comments

@tsint
Copy link
Contributor

tsint commented Nov 8, 2024

The previous and related discussions were happening in #225.
Here is an analysis of the needs and issues people face:

Main Needs:

  1. Enable the debugging for the tracer at any time by the parameter to obtain more meaningful information without needing to recompile it.
  2. When the debugging is not needed, disable it by remove the parameter to run the profiler with optimal performance.
  3. If possible, integrate the BPF program of the profiler into third-party applications with the debug tracer to be enabled, and get valuable information in some way.

Main Issue:
When binary files are committed to the git repository, the storage space quickly increases with each commit.

My Solution:

  1. Build both the release and debug tracer by default, and enable or disable tracer debugging as needed.
  2. Publish a profiler with the debug tracer on a branch synchronized with the mainline, and tagged with a special label like v1.0.1-debug to make integration easy.

Implementation Steps:

  1. Modify the Makefile in the root directory, select different GO_TAGS and BPF program compilation commands based on the branch .
-GO_TAGS := osusergo,netgo
-EBPF_FLAGS :=
+ifneq (,$(findstring debug,$(BRANCH)))
+    GO_TAGS := osusergo,netgo
+    EBPF_FLAGS := fake-release
+else
+    GO_TAGS := osusergo,netgo,debugtracer
+    EBPF_FLAGS :=
+endif


-debug: GO_TAGS := $(GO_TAGS),debugtracer
-debug: EBPF_FLAGS += debug
-debug: all
  1. Modify the Makefile in the support/ebpf directory, and compile two versions of the tracer by default. If the debug tracer need to be released, compile only the debug version tracer and rename it as the release version tracer. By this way, third-party applications can use v1.0.1-debug to reference the debug version tracer.
-TRACER_NAME ?= tracer.ebpf.$(BUILD_TYPE).$(TARGET_ARCH)
+TRACER ?= tracer.ebpf.release.$(TARGET_ARCH)
+DEBUG_TRACER ?= tracer.ebpf.debug.$(TARGET_ARCH)
+
+TARGET ?= $(TRACER) $(DEBUG_TRACER)


-ifeq ($(BUILD_TYPE),debug)
-       TARGET_FLAGS+=$(DEBUG_FLAGS)
-endif


 SRCS := $(wildcard *.ebpf.c)
-OBJS := $(SRCS:.c=.$(BUILD_TYPE).$(TARGET_ARCH).o)
+OBJS := $(SRCS:.c=.release.$(TARGET_ARCH).o)
+DEBUG_OBJS := $(SRCS:.c=.debug.$(TARGET_ARCH).o)

-all: $(TRACER_NAME)
+all: $(TARGET)

-debug:
-       $(MAKE) BUILD_TYPE=debug
+fake-release:
+       $(MAKE) TARGET=$(DEBUG_TRACER)
+       mv $(DEBUG_TRACER) $(TRACER)
@tsint
Copy link
Contributor Author

tsint commented Nov 8, 2024

A friendly ping to people to join this discussion. @florianl @rockdaboot @umanwizard @Gandem @athre0z @dmathieu @christos68k

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

No branches or pull requests

1 participant