Parcourir la source

Feature #TASK_QT-31498 修正agentVersion

Carl il y a 5 mois
Parent
commit
a0b4f28d29

+ 2 - 1
pkg/go.opentelemetry.io/otel/exporters/otlp/otlptrace/apm_exporter.go

@@ -429,11 +429,12 @@ func initRootDataFromEvent() RootDataT {
 	sip := utils.GetHostIP()
 	sysTag := utils.GetSysTag()
 	systemUUID := utils.GetSystemUUID()
+	agentVersion := utils.GetAgentVersion()
 	data := RootDataT{
 		// todo AccountId
 		AccountId:       accountID,
 		AgentId:         0, // 基于 ip:port + process_name + exe路径生成
-		AgentVersion:    "2.1.0",
+		AgentVersion:    agentVersion,
 		AppId:           0, // 基于appname生成
 		AppIdFrom:       -1,
 		AppName:         "eBPF-agent", // server配置

+ 7 - 0
utils/id.go

@@ -119,6 +119,13 @@ func SystemUUID() string {
 	return ""
 }
 
+func GetAgentVersion() string {
+	if NODE_INFO != nil {
+		return NODE_INFO.AgentVersion
+	}
+	return ""
+}
+
 func hexdec(hexStr string) int {
 	dec, _ := strconv.ParseInt(hexStr, 16, 64)
 	return int(dec)