-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2139-apm-inject' into 'dev'
apm auto-inject launcher See merge request cloudcare-tools/datakit!3229
- Loading branch information
Showing
24 changed files
with
1,582 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ARG TARGETARCH | ||
|
||
RUN export DEBIAN_FRONTEND=noninteractive \ | ||
&& sed -i 's/\(archive\|security\|ports\).ubuntu.com/mirrors.aliyun.com/' /etc/apt/sources.list \ | ||
&& apt-get update && apt-get install -y make curl tree tzdata gcc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM alpine:3.14 | ||
|
||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \ | ||
&& apk add make build-base alpine-sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
.PHONY: all debug rewriter test | ||
|
||
ARCH ?= $(shell uname -m | sed -e s/x86_64/x86_64/ \ | ||
-e s/aarch64.\*/aarch64/) | ||
|
||
ifeq ($(ARCH), x86_64) | ||
ARCH = amd64 | ||
endif | ||
ifeq ($(ARCH), aarch64) | ||
ARCH = arm64 | ||
endif | ||
|
||
REPO_PATH ?= ${HOME}/go/src/gitlab.jiagouyun.com/cloudcare-tools/datakit | ||
SOURCE_PATH := $(REPO_PATH)/internal/apminject | ||
DIST_DIR ?= $(REPO_PATH)/internal/apminject/dist/datakit-apm-inject-linux-$(ARCH) | ||
|
||
DATAKIT_INJ_REWRITE_PROC ?= \"/usr/local/datakit/apm_inject/inject/rewriter\" | ||
|
||
all: rewriter launcher | ||
|
||
rewriter: | ||
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -o $(DIST_DIR)/rewriter \ | ||
$(SOURCE_PATH)/rewriter/rewriter.go | ||
|
||
launcher: | ||
mkdir -p $(DIST_DIR) | ||
gcc -DDATAKIT_INJ_REWRITE_PROC=${DATAKIT_INJ_REWRITE_PROC} \ | ||
$(SOURCE_PATH)/apm_launcher.c -fPIC -shared \ | ||
-o $(DIST_DIR)/apm_launcher.so | ||
|
||
launcher_musl: | ||
mkdir -p $(DIST_DIR) | ||
gcc -DDATAKIT_INJ_REWRITE_PROC=${DATAKIT_INJ_REWRITE_PROC} \ | ||
$(SOURCE_PATH)/apm_launcher.c -fPIC -shared \ | ||
-o $(DIST_DIR)/apm_launcher_musl.so | ||
|
||
launcher_debug: | ||
mkdir -p ${DIST_DIR} | ||
gcc -DDATAKIT_DEBUG -DDATAKIT_INJ_REWRITE_PROC=${DATAKIT_INJ_REWRITE_PROC} \ | ||
$(SOURCE_PATH)/apm_launcher.c -fPIC -shared \ | ||
-o $(DIST_DIR)/apm_launcher_debug.so | ||
|
||
launcher_musl_debug: | ||
mkdir -p ${DIST_DIR} | ||
gcc -DDATAKIT_DEBUG -DDATAKIT_INJ_REWRITE_PROC=${DATAKIT_INJ_REWRITE_PROC} \ | ||
$(SOURCE_PATH)/apm_launcher.c -fPIC -shared \ | ||
-o $(DIST_DIR)/apm_launcher_musl_debug.so | ||
|
||
test: | ||
mkdir -p ${DIST_DIR} | ||
gcc $(SOURCE_PATH)/launcher_test.c -o $(DIST_DIR)/launcher_test \ | ||
&& $(DIST_DIR)/launcher_test && rm $(DIST_DIR)/launcher_test |
Oops, something went wrong.