mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-20 14:54:21 +01:00
runtime: add new command to collect metrics from Kata containers
Add a new command to collect metrics and return metrics to Prometheus. Signed-off-by: bin liu <bin@hyper.sh>
This commit is contained in:
@@ -208,6 +208,11 @@ SHIMV2 = containerd-shim-kata-v2
|
||||
SHIMV2_OUTPUT = $(CURDIR)/$(SHIMV2)
|
||||
SHIMV2_DIR = $(CLI_DIR)/$(SHIMV2)
|
||||
|
||||
MONITOR = kata-monitor
|
||||
MONITOR_OUTPUT = $(CURDIR)/$(MONITOR)
|
||||
MONITOR_DIR = $(CLI_DIR)/kata-monitor
|
||||
|
||||
|
||||
SOURCES := $(shell find . 2>&1 | grep -E '.*\.(c|h|go)$$')
|
||||
VERSION := ${shell cat ./VERSION}
|
||||
|
||||
@@ -509,7 +514,7 @@ define SHOW_ARCH
|
||||
$(shell printf "\\t%s%s\\\n" "$(1)" $(if $(filter $(ARCH),$(1))," (default)",""))
|
||||
endef
|
||||
|
||||
all: runtime containerd-shim-v2 netmon
|
||||
all: runtime containerd-shim-v2 netmon monitor
|
||||
|
||||
# Targets that depend on .git-commit can use $(shell cat .git-commit) to get a
|
||||
# git revision string. They will only be rebuilt if the revision string
|
||||
@@ -523,6 +528,8 @@ all: runtime containerd-shim-v2 netmon
|
||||
|
||||
containerd-shim-v2: $(SHIMV2_OUTPUT)
|
||||
|
||||
monitor: $(MONITOR_OUTPUT)
|
||||
|
||||
netmon: $(NETMON_TARGET_OUTPUT)
|
||||
|
||||
$(NETMON_TARGET_OUTPUT): $(SOURCES) VERSION
|
||||
@@ -571,6 +578,9 @@ $(SHIMV2_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST)
|
||||
$(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && ln -fs $(GENERATED_CONFIG))
|
||||
$(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && go build $(KATA_LDFLAGS) $(BUILDFLAGS) -o $@ .)
|
||||
|
||||
$(MONITOR_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST)
|
||||
$(QUIET_BUILD)(cd $(MONITOR_DIR)/ && go build $(KATA_LDFLAGS) $(BUILDFLAGS) -o $@ .)
|
||||
|
||||
.PHONY: \
|
||||
check \
|
||||
check-go-static \
|
||||
@@ -688,7 +698,7 @@ coverage:
|
||||
go test -v -mod=vendor -covermode=atomic -coverprofile=coverage.txt ./...
|
||||
go tool cover -html=coverage.txt -o coverage.html
|
||||
|
||||
install: default install-runtime install-containerd-shim-v2 install-netmon
|
||||
install: default install-runtime install-containerd-shim-v2 install-monitor install-netmon
|
||||
|
||||
install-bin: $(BINLIST)
|
||||
$(QUIET_INST)$(foreach f,$(BINLIST),$(call INSTALL_EXEC,$f,$(BINDIR)))
|
||||
@@ -700,6 +710,9 @@ install-netmon: install-bin-libexec
|
||||
install-containerd-shim-v2: $(SHIMV2)
|
||||
$(QUIET_INST)$(call INSTALL_EXEC,$<,$(BINDIR))
|
||||
|
||||
install-monitor: $(MONITOR)
|
||||
$(QUIET_INST)$(call INSTALL_EXEC,$<,$(BINDIR))
|
||||
|
||||
install-bin-libexec: $(BINLIBEXECLIST)
|
||||
$(QUIET_INST)$(foreach f,$(BINLIBEXECLIST),$(call INSTALL_EXEC,$f,$(PKGLIBEXECDIR)))
|
||||
|
||||
@@ -718,6 +731,7 @@ clean:
|
||||
$(CONFIGS) \
|
||||
$(GENERATED_FILES) \
|
||||
$(NETMON_TARGET) \
|
||||
$(MONITOR) \
|
||||
$(SHIMV2) \
|
||||
$(SHIMV2_DIR)/$(notdir $(GENERATED_CONFIG)) \
|
||||
$(TARGET) \
|
||||
@@ -805,6 +819,8 @@ endif
|
||||
"$(foreach b,$(sort $(BINLIST)),$(shell printf "\\t - $(shell readlink -m $(DESTDIR)/$(BINDIR)/$(b))\\\n"))"
|
||||
@printf \
|
||||
"$(foreach b,$(sort $(SHIMV2)),$(shell printf "\\t - $(shell readlink -m $(DESTDIR)/$(BINDIR)/$(b))\\\n"))"
|
||||
@printf \
|
||||
"$(foreach b,$(sort $(MONITOR)),$(shell printf "\\t - $(shell readlink -m $(DESTDIR)/$(BINDIR)/$(b))\\\n"))"
|
||||
@printf \
|
||||
"$(foreach b,$(sort $(BINLIBEXECLIST)),$(shell printf "\\t - $(shell readlink -m $(DESTDIR)/$(PKGLIBEXECDIR)/$(b))\\\n"))"
|
||||
@printf \
|
||||
|
||||
Reference in New Issue
Block a user