From 600d70190cb9f357de9f3f87b687107e9819f51c Mon Sep 17 00:00:00 2001 From: KevinBetterQ <1093850932@qq.com> Date: Tue, 4 Jun 2019 10:16:49 +0800 Subject: [PATCH] feature: add kernel info to EngineVersion metric Signed-off-by: KevinBetterQ <1093850932@qq.com> --- main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 5be38bfa05..55c9e33cf5 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,7 @@ import ( "github.com/alibaba/pouch/daemon/config" "github.com/alibaba/pouch/lxcfs" "github.com/alibaba/pouch/pkg/debug" + "github.com/alibaba/pouch/pkg/kernel" "github.com/alibaba/pouch/pkg/utils" "github.com/alibaba/pouch/storage/quota" "github.com/alibaba/pouch/version" @@ -167,7 +168,15 @@ func runDaemon(cmd *cobra.Command) error { fmt.Printf("pouchd version: %s, build: %s, build at: %s\n", version.Version, version.GitCommit, version.BuildTime) return nil } - metrics.EngineVersion.WithLabelValues(version.GitCommit).Set(1) + + kernelVersion, err := kernel.GetKernelVersion() + if err != nil { + return fmt.Errorf("failed to get kernel version: %s", err) + } + metrics.EngineVersion.WithLabelValues( + fmt.Sprintf("%s BUILDTIME:%s Pouch", version.GitCommit, version.BuildTime), + version.Version, + kernelVersion.String()).Set(1) // initialize log. initLog()