The previous and related discussions were happening in #225.
Here is an analysis of the needs and issues people face:
Main Needs:
- Enable the debugging for the tracer at any time by the parameter to obtain more meaningful information without needing to recompile it.
- When the debugging is not needed, disable it by remove the parameter to run the profiler with optimal performance.
- 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:
- Build both the release and debug tracer by default, and enable or disable tracer debugging as needed.
- 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:
- 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
- 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)
The previous and related discussions were happening in #225.
Here is an analysis of the needs and issues people face:
Main Needs:
Main Issue:
When binary files are committed to the git repository, the storage space quickly increases with each commit.
My Solution:
v1.0.1-debugto make integration easy.Implementation Steps:
GO_TAGSand BPF program compilation commands based on the branch .support/ebpfdirectory, 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 usev1.0.1-debugto reference the debug version tracer.