Przeglądaj źródła

Merge branch 'dev-wilson' into dev

Carl 1 rok temu
rodzic
commit
ff5c7a81be

+ 74 - 0
containers/apm_ebpf_appinfo.go

@@ -0,0 +1,74 @@
+package containers
+
+import (
+	. "github.com/coroot/coroot-node-agent/utils/modelse"
+	klog "github.com/sirupsen/logrus"
+	"sync"
+	"time"
+)
+
+type AppInfoFromServerT struct {
+	AppInfo *EbpfAppResp
+	lock    *sync.RWMutex
+}
+
+var AppInfoFromServer AppInfoFromServerT
+
+func init() {
+	AppInfoFromServer = AppInfoFromServerT{
+		AppInfo: new(EbpfAppResp),
+		lock:    &sync.RWMutex{},
+	}
+}
+
+func (r *Registry) PullAllAppInfo() {
+	gcTicker := time.NewTicker(AllAppInfoInterval)
+	defer gcTicker.Stop()
+	for {
+		select {
+		case <-gcTicker.C:
+			req := EbpfAppReq{
+				AccountId: r.nodeInfo.GetNodeInfo().AccountID,
+			}
+			res, err := r.connServer.PullAllAppInfo(req)
+			if err != nil {
+				klog.Errorf("PullAllAppInfo err: %v", err)
+			}
+			r.SaveAppinfos(&res)
+			//fmt.Println(r.GetAppInfoByIpPort("12.3.1.2:9999"))
+		}
+	}
+}
+
+func (r *Registry) SaveAppinfos(appinfos *EbpfAppResp) {
+	AppInfoFromServer.lock.Lock()
+	defer AppInfoFromServer.lock.Unlock()
+	AppInfoFromServer.AppInfo = appinfos
+}
+
+func (r *Registry) GetAppInfoByIpPort(ipPort string) string {
+	AppInfoFromServer.lock.Lock()
+	defer AppInfoFromServer.lock.Unlock()
+	if AppInfoFromServer.AppInfo == nil {
+		return ""
+	}
+	info := *AppInfoFromServer.AppInfo
+	if info == nil {
+		return ""
+	}
+	appName, ok := info[ipPort]
+	if ok {
+		return appName
+	}
+	return ""
+}
+
+func (r *Registry) GetAllAppInfoFromServer() map[string]string {
+	AppInfoFromServer.lock.Lock()
+	defer AppInfoFromServer.lock.Unlock()
+	appinfos := make(map[string]string)
+	if AppInfoFromServer.AppInfo != nil {
+		appinfos = *AppInfoFromServer.AppInfo
+	}
+	return appinfos
+}

+ 3 - 2
containers/apm_register_app.go

@@ -25,7 +25,7 @@ func (c *Container) RegisterAppInfo(r *Registry, pid uint32) error {
 		if err != nil {
 		if err != nil {
 			return err
 			return err
 		}
 		}
-		c.AppInfo.ServiceName = c.AppInfo.CodeType.ServiceTypeString()
+		c.AppInfo.ServiceType = c.AppInfo.CodeType.ServiceTypeString()
 		// 注册
 		// 注册
 		nodeInfo := r.nodeInfo.GetNodeInfo()
 		nodeInfo := r.nodeInfo.GetNodeInfo()
 		if nodeInfo == nil {
 		if nodeInfo == nil {
@@ -40,9 +40,10 @@ func (c *Container) RegisterAppInfo(r *Registry, pid uint32) error {
 			AgentId:     c.AppInfo.AgentId,
 			AgentId:     c.AppInfo.AgentId,
 			Sn:          c.AppInfo.Sn,
 			Sn:          c.AppInfo.Sn,
 			Sport:       c.AppInfo.Sport,
 			Sport:       c.AppInfo.Sport,
-			ServiceType: c.AppInfo.ServiceName,
+			ServiceType: c.AppInfo.ServiceType,
 			CodeType:    c.AppInfo.CodeType.Int(),
 			CodeType:    c.AppInfo.CodeType.Int(),
 			App_type:    1,
 			App_type:    1,
+			AppLang:     "ebpf",
 		}
 		}
 		klog.Infof("[register app] Register App req: %s.", registerAppReq.String())
 		klog.Infof("[register app] Register App req: %s.", registerAppReq.String())
 		err = r.connServer.RegisterApp(registerAppReq)
 		err = r.connServer.RegisterApp(registerAppReq)

+ 15 - 13
containers/container.go

@@ -34,8 +34,9 @@ import (
 )
 )
 
 
 var (
 var (
-	gcInterval  = 10 * time.Second
-	pingTimeout = 300 * time.Millisecond
+	gcInterval         = 10 * time.Second
+	AllAppInfoInterval = 1 * time.Minute
+	pingTimeout        = 300 * time.Millisecond
 )
 )
 
 
 type ContainerID string
 type ContainerID string
@@ -375,21 +376,22 @@ func (c *Container) Collect(ch chan<- prometheus.Metric) {
 	strInstanceID := strconv.FormatInt(c.AppInfo.InstanceIdHash.IntVal, 10)
 	strInstanceID := strconv.FormatInt(c.AppInfo.InstanceIdHash.IntVal, 10)
 	strAppId := strconv.FormatInt(c.AppInfo.AppIdHash.IntVal, 10)
 	strAppId := strconv.FormatInt(c.AppInfo.AppIdHash.IntVal, 10)
 	strAppName := c.AppInfo.AppName
 	strAppName := c.AppInfo.AppName
-
+	apps := c.registry.GetAllAppInfoFromServer()
 	for d, stats := range c.connectsSuccessful {
 	for d, stats := range c.connectsSuccessful {
-		ch <- counter(metrics.NetConnectionsSuccessful, float64(stats.Count), strInstanceID, strAppId, strAppName, stats.Src.String(), d.src.String(), d.dst.String())
-		ch <- counter(metrics.NetConnectionsTotalTime, stats.TotalTime.Seconds(), strInstanceID, strAppId, strAppName, stats.Src.String(), d.src.String(), d.dst.String())
+		targetAppId := apps[stats.Src.String()]
+		ch <- counter(metrics.NetConnectionsSuccessful, float64(stats.Count), strInstanceID, strAppId, targetAppId, strAppName, stats.Src.String(), d.src.String(), d.dst.String())
+		ch <- counter(metrics.NetConnectionsTotalTime, stats.TotalTime.Seconds(), strInstanceID, strAppId, targetAppId, strAppName, stats.Src.String(), d.src.String(), d.dst.String())
 		if stats.Retransmissions > 0 {
 		if stats.Retransmissions > 0 {
-			ch <- counter(metrics.NetRetransmits, float64(stats.Retransmissions), strInstanceID, strAppId, strAppName, stats.Src.String(), d.src.String(), d.dst.String())
+			ch <- counter(metrics.NetRetransmits, float64(stats.Retransmissions), strInstanceID, strAppId, targetAppId, strAppName, stats.Src.String(), d.src.String(), d.dst.String())
 		}
 		}
-		ch <- counter(metrics.NetBytesSent, float64(stats.BytesSent), strInstanceID, strAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
-		ch <- counter(metrics.NetBytesReceived, float64(stats.BytesReceived), strInstanceID, strAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
-		ch <- counter(metrics.NetBytesSentPer, float64(stats.PerBytesSent), strInstanceID, strAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
-		ch <- counter(metrics.NetBytesReceivedPer, float64(stats.PerBytesReceived), strInstanceID, strAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
+		ch <- counter(metrics.NetBytesSent, float64(stats.BytesSent), strInstanceID, strAppId, targetAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
+		ch <- counter(metrics.NetBytesReceived, float64(stats.BytesReceived), strInstanceID, strAppId, targetAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
+		ch <- counter(metrics.NetBytesSentPer, float64(stats.PerBytesSent), strInstanceID, strAppId, targetAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
+		ch <- counter(metrics.NetBytesReceivedPer, float64(stats.PerBytesReceived), strInstanceID, strAppId, targetAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
 
 
-		ch <- counter(metrics.NetDataLatency, float64(stats.FirstReadTime-stats.FirstWriteTime), strInstanceID, strAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
-		ch <- counter(metrics.NetDataDuration, float64(stats.NewReadTime-stats.FirstWriteTime), strInstanceID, strAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
-		ch <- counter(metrics.NetEstTime, float64(stats.ConEstTime), strInstanceID, strAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
+		ch <- counter(metrics.NetDataLatency, float64(stats.FirstReadTime-stats.FirstWriteTime), strInstanceID, strAppId, targetAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
+		ch <- counter(metrics.NetDataDuration, float64(stats.NewReadTime-stats.FirstWriteTime), strInstanceID, strAppId, targetAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
+		ch <- counter(metrics.NetEstTime, float64(stats.ConEstTime), strInstanceID, strAppId, targetAppId, strAppName, stats.Src.String(), d.dst.String(), d.dst.String())
 
 
 		klog.Infof("c.connectsSuccessful d.src=%s d.dst=%s stats.BytesSent=%d,stats.BytesReceived=%d stats.PerBytesSent=%d,stats.PerBytesReceived=%d,stats.datalatency=%d,stats.dataduration=%d,stats.estTime=%d", stats.Src.String(), d.dst.String(), stats.BytesSent, stats.BytesReceived, stats.PerBytesSent, stats.PerBytesReceived, stats.FirstReadTime-stats.FirstWriteTime, stats.NewReadTime-stats.FirstWriteTime, stats.ConEstTime)
 		klog.Infof("c.connectsSuccessful d.src=%s d.dst=%s stats.BytesSent=%d,stats.BytesReceived=%d stats.PerBytesSent=%d,stats.PerBytesReceived=%d,stats.datalatency=%d,stats.dataduration=%d,stats.estTime=%d", stats.Src.String(), d.dst.String(), stats.BytesSent, stats.BytesReceived, stats.PerBytesSent, stats.PerBytesReceived, stats.FirstReadTime-stats.FirstWriteTime, stats.NewReadTime-stats.FirstWriteTime, stats.ConEstTime)
 		stats.PerBytesReceived = 0
 		stats.PerBytesReceived = 0

+ 30 - 12
containers/container_apm.go

@@ -270,26 +270,44 @@ func (c *Container) buildIDs(pid uint32) bool {
 	if p != nil {
 	if p != nil {
 		p.cmdline = string(proc.GetRealCmdline(pid))
 		p.cmdline = string(proc.GetRealCmdline(pid))
 	}
 	}
+	var sns []string
+	var sport uint16
 	for address, val := range c.getListens() {
 	for address, val := range c.getListens() {
 		if val == 1 {
 		if val == 1 {
 			ip := address.IP()
 			ip := address.IP()
 			if ip.Is4() && !ip.IsLoopback() {
 			if ip.Is4() && !ip.IsLoopback() {
 				// 获取端口号
 				// 获取端口号
-				port := address.Port()
-				//c.instanceID.IntVal, c.instanceID.HashtVal, _ =
-				c.AppInfo.Sn = ip.String()
-				c.AppInfo.Sport = int(port)
-				strInstanceID := utils.BuildInt64ID(fmt.Sprintf("%s:%d", ip.String(), port))
-				c.AppInfo.InstanceIdHash.IntVal, _ = strInstanceID.ToInt64()
-				c.AppInfo.InstanceIdHash.HashtVal = strInstanceID.ToHashByte()
-				//c.AppInfo.InstanceId = c.instanceID.IntVal
-				strAgentID := utils.BuildInt64ID(fmt.Sprintf("%s:%s", strInstanceID, string(proc.GetExe(pid))))
-				c.AppInfo.AgentId, _ = strAgentID.ToInt64()
-				c.AppInfo.CodeType = c.GetCodeTypeFromCache(pid)
-				return true
+				sport = address.Port()
+				sns = append(sns, fmt.Sprintf("%s:%d", ip, sport))
+				////c.instanceID.IntVal, c.instanceID.HashtVal, _ =
+				//c.AppInfo.Sn = ip.String()
+				//c.AppInfo.Sport = int(port)
+				//strInstanceID := utils.BuildInt64ID(fmt.Sprintf("%s:%d", ip.String(), port))
+				//fmt.Println(port)
+				////os.Exit(1)
+				//c.AppInfo.InstanceIdHash.IntVal, _ = strInstanceID.ToInt64()
+				//c.AppInfo.InstanceIdHash.HashtVal = strInstanceID.ToHashByte()
+				////c.AppInfo.InstanceId = c.instanceID.IntVal
+				//strAgentID := utils.BuildInt64ID(fmt.Sprintf("%s:%s", strInstanceID, string(proc.GetExe(pid))))
+				//c.AppInfo.AgentId, _ = strAgentID.ToInt64()
+				//c.AppInfo.CodeType = c.GetCodeTypeFromCache(pid)
+				//return true
 			}
 			}
 		}
 		}
 	}
 	}
+	if len(sns) > 0 {
+		//c.instanceID.IntVal, c.instanceID.HashtVal, _ =
+		snsStr := strings.Join(sns, ",")
+		c.AppInfo.Sn = snsStr
+		c.AppInfo.Sport = int(sport)
+		strInstanceID := utils.BuildInt64ID(fmt.Sprintf("%s:%d", c.AppInfo.Sn, sport))
+		c.AppInfo.InstanceIdHash.IntVal, _ = strInstanceID.ToInt64()
+		c.AppInfo.InstanceIdHash.HashtVal = strInstanceID.ToHashByte()
+		strAgentID := utils.BuildInt64ID(fmt.Sprintf("%s:%s", utils.GetHostIP(), string(proc.GetExe(pid))))
+		c.AppInfo.AgentId, _ = strAgentID.ToInt64()
+		c.AppInfo.CodeType = c.GetCodeTypeFromCache(pid)
+		return true
+	}
 	return false
 	return false
 }
 }
 
 

+ 20 - 21
containers/metrics.go

@@ -39,15 +39,14 @@ var metrics = struct {
 	NetBytesReceived         *prometheus.Desc
 	NetBytesReceived         *prometheus.Desc
 	NetBytesSentPer          *prometheus.Desc
 	NetBytesSentPer          *prometheus.Desc
 	NetBytesReceivedPer      *prometheus.Desc
 	NetBytesReceivedPer      *prometheus.Desc
-	NetDataLatency      	 *prometheus.Desc
-	NetDataDuration			 *prometheus.Desc
-	NetEstTime			 	 *prometheus.Desc
+	NetDataLatency           *prometheus.Desc
+	NetDataDuration          *prometheus.Desc
+	NetEstTime               *prometheus.Desc
 
 
-
-	NetAcceptsSuccessful 	 *prometheus.Desc
-	NetAcceptsActive     	 *prometheus.Desc
-	NetAcceptBytesSent       *prometheus.Desc
-	NetAcceptBytesReceived    *prometheus.Desc
+	NetAcceptsSuccessful   *prometheus.Desc
+	NetAcceptsActive       *prometheus.Desc
+	NetAcceptBytesSent     *prometheus.Desc
+	NetAcceptBytesReceived *prometheus.Desc
 
 
 	LogMessages *prometheus.Desc
 	LogMessages *prometheus.Desc
 
 
@@ -88,23 +87,23 @@ var metrics = struct {
 	DiskWriteBytes: metric("process_resources_disk_written_bytes_total", "Total number of bytes written to the disk by the process", "mount_point", "device", "volume"),
 	DiskWriteBytes: metric("process_resources_disk_written_bytes_total", "Total number of bytes written to the disk by the process", "mount_point", "device", "volume"),
 
 
 	NetListenInfo:            metric("process_net_tcp_listen_info", "Listen address of the process", "listen_addr", "proxy"),
 	NetListenInfo:            metric("process_net_tcp_listen_info", "Listen address of the process", "listen_addr", "proxy"),
-	NetConnectionsSuccessful: metric("process_net_tcp_successful_connects_total", "Total number of successful TCP connects", "instance_id","app_id","app_name","src", "destination", "actual_destination"),
-	NetConnectionsTotalTime:  metric("process_net_tcp_connection_time_seconds_total", "Time spent on TCP connections", "instance_id","app_id","app_name","src","destination", "actual_destination"),
-	NetConnectionsFailed:     metric("process_net_tcp_failed_connects_total", "Total number of failed TCP connects", "instance_id","app_id","app_name","destination"),
+	NetConnectionsSuccessful: metric("process_net_tcp_successful_connects_total", "Total number of successful TCP connects", "instance_id", "app_id", "target_app_id", "app_name", "src", "destination", "actual_destination"),
+	NetConnectionsTotalTime:  metric("process_net_tcp_connection_time_seconds_total", "Time spent on TCP connections", "instance_id", "app_id", "target_app_id", "app_name", "src", "destination", "actual_destination"),
+	NetConnectionsFailed:     metric("process_net_tcp_failed_connects_total", "Total number of failed TCP connects", "instance_id", "app_id", "target_app_id", "app_name", "destination"),
 	NetConnectionsActive:     metric("process_net_tcp_active_connections", "Number of active outbound connections used by the process", "destination", "actual_destination"),
 	NetConnectionsActive:     metric("process_net_tcp_active_connections", "Number of active outbound connections used by the process", "destination", "actual_destination"),
-	NetRetransmits:           metric("process_net_tcp_retransmits_total", "Total number of retransmitted TCP segments", "instance_id","app_id","app_name","src","destination", "actual_destination"),
+	NetRetransmits:           metric("process_net_tcp_retransmits_total", "Total number of retransmitted TCP segments", "instance_id", "app_id", "target_app_id", "app_name", "src", "destination", "actual_destination"),
 	NetLatency:               metric("process_net_latency_seconds", "Round-trip time between the process and a remote IP", "destination_ip"),
 	NetLatency:               metric("process_net_latency_seconds", "Round-trip time between the process and a remote IP", "destination_ip"),
-	NetBytesSent:             metric("process_net_tcp_bytes_sent_total", "Total number of bytes sent to the peer", "instance_id","app_id","app_name","src","destination", "actual_destination"),
-	NetBytesReceived:         metric("process_net_tcp_bytes_received_total", "Total number of bytes received from the peer", "instance_id","app_id","app_name","src","destination", "actual_destination"),
-	NetBytesSentPer:          metric("process_net_tcp_bytes_sent_per", "Per number of bytes sent to the peer", "instance_id","app_id","app_name","src","destination", "actual_destination"),
-	NetBytesReceivedPer:      metric("process_net_tcp_bytes_received_per", "Per number of bytes received from the peer", "instance_id","app_id","app_name","src","destination", "actual_destination"),
-	NetAcceptsSuccessful: 	  metric("process_net_tcp_successful_accept_total", "Total number of successful TCP accepts", "destination", "actual_destination"),
+	NetBytesSent:             metric("process_net_tcp_bytes_sent_total", "Total number of bytes sent to the peer", "instance_id", "app_id", "target_app_id", "app_name", "src", "destination", "actual_destination"),
+	NetBytesReceived:         metric("process_net_tcp_bytes_received_total", "Total number of bytes received from the peer", "instance_id", "app_id", "target_app_id", "app_name", "src", "destination", "actual_destination"),
+	NetBytesSentPer:          metric("process_net_tcp_bytes_sent_per", "Per number of bytes sent to the peer", "instance_id", "app_id", "target_app_id", "app_name", "src", "destination", "actual_destination"),
+	NetBytesReceivedPer:      metric("process_net_tcp_bytes_received_per", "Per number of bytes received from the peer", "instance_id", "app_id", "target_app_id", "app_name", "src", "destination", "actual_destination"),
+	NetAcceptsSuccessful:     metric("process_net_tcp_successful_accept_total", "Total number of successful TCP accepts", "destination", "actual_destination"),
 	NetAcceptBytesSent:       metric("process_net_tcp_bytes_sent_accept_total", "Total number of bytes sent to the peer", "destination", "actual_destination"),
 	NetAcceptBytesSent:       metric("process_net_tcp_bytes_sent_accept_total", "Total number of bytes sent to the peer", "destination", "actual_destination"),
 	NetAcceptBytesReceived:   metric("process_net_tcp_bytes_received_accept_total", "Total number of bytes received from the peer", "destination", "actual_destination"),
 	NetAcceptBytesReceived:   metric("process_net_tcp_bytes_received_accept_total", "Total number of bytes received from the peer", "destination", "actual_destination"),
-	NetDataLatency:      	  metric("process_net_tcp_data_latency", "Data latency", "instance_id","app_id","app_name","src","destination", "actual_destination"),
-	NetDataDuration:      	  metric("process_net_tcp_data_duration", "Data duration", "instance_id","app_id","app_name","src","destination", "actual_destination"),
-	NetEstTime:      	  	  metric("process_net_tcp_est_time", "Established time", "instance_id","app_id","app_name","src","destination", "actual_destination"),
-	
+	NetDataLatency:           metric("process_net_tcp_data_latency", "Data latency", "instance_id", "app_id", "target_app_id", "app_name", "src", "destination", "actual_destination"),
+	NetDataDuration:          metric("process_net_tcp_data_duration", "Data duration", "instance_id", "app_id", "target_app_id", "app_name", "src", "destination", "actual_destination"),
+	NetEstTime:               metric("process_net_tcp_est_time", "Established time", "instance_id", "app_id", "target_app_id", "app_name", "src", "destination", "actual_destination"),
+
 	LogMessages: metric("process_log_messages_total", "Number of messages grouped by the automatically extracted repeated pattern", "source", "level", "pattern_hash", "sample"),
 	LogMessages: metric("process_log_messages_total", "Number of messages grouped by the automatically extracted repeated pattern", "source", "level", "pattern_hash", "sample"),
 
 
 	ApplicationType: metric("process_application_type", "Type of the application running in the process (e.g. memcached, postgres, mysql)", "application_type"),
 	ApplicationType: metric("process_application_type", "Type of the application running in the process (e.g. memcached, postgres, mysql)", "application_type"),

+ 9 - 5
containers/registry.go

@@ -172,7 +172,7 @@ func NewRegistry(reg prometheus.Registerer, kernelVersion string, nodeInfo *Node
 	//if err != nil {
 	//if err != nil {
 	//	return nil, err
 	//	return nil, err
 	//}
 	//}
-
+	try.Go(r.PullAllAppInfo, CatchFn)
 	go r.handleEvents(r.events)
 	go r.handleEvents(r.events)
 	if err = r.tracer.Run(r.events); err != nil {
 	if err = r.tracer.Run(r.events); err != nil {
 		close(r.events)
 		close(r.events)
@@ -374,8 +374,10 @@ func (r *Registry) handleEvents(ch <-chan ebpftracer.Event) {
 				if c := r.getOrCreateContainer(e.Pid); c != nil {
 				if c := r.getOrCreateContainer(e.Pid); c != nil {
 					c.onListenOpen(e.Pid, e.SrcAddr, false)
 					c.onListenOpen(e.Pid, e.SrcAddr, false)
 					// cmdline InstanceID agentID
 					// cmdline InstanceID agentID
-					if c.buildIDs(e.Pid) {
-						c.eventReady()
+					if !common.IsOpenFilter() || common.IsFilterPid(e.Pid) {
+						if c.buildIDs(e.Pid) {
+							c.eventReady()
+						}
 					}
 					}
 					if common.IsOpenFilter() && common.IsFilterPid(e.Pid) {
 					if common.IsOpenFilter() && common.IsFilterPid(e.Pid) {
 						c.WhiteSettingInfo.AppName = enums.TestApp
 						c.WhiteSettingInfo.AppName = enums.TestApp
@@ -407,8 +409,10 @@ func (r *Registry) handleEvents(ch <-chan ebpftracer.Event) {
 				//fmt.Println("ebpftracer.EventTypeConnectionOpen==================", e.Pid)
 				//fmt.Println("ebpftracer.EventTypeConnectionOpen==================", e.Pid)
 				if c := r.getOrCreateContainer(e.Pid); c != nil {
 				if c := r.getOrCreateContainer(e.Pid); c != nil {
 					c.onConnectionOpen(e.Pid, e.Fd, e.SrcAddr, e.DstAddr, e.Timestamp, false, e.Duration)
 					c.onConnectionOpen(e.Pid, e.Fd, e.SrcAddr, e.DstAddr, e.Timestamp, false, e.Duration)
-					if !c.checkEventReady() && c.buildIDs(e.Pid) {
-						c.eventReady()
+					if !common.IsOpenFilter() || common.IsFilterPid(e.Pid) {
+						if !c.checkEventReady() && c.buildIDs(e.Pid) {
+							c.eventReady()
+						}
 					}
 					}
 					if common.IsOpenFilter() && common.IsFilterPid(e.Pid) {
 					if common.IsOpenFilter() && common.IsFilterPid(e.Pid) {
 						c.WhiteSettingInfo.AppName = enums.TestApp
 						c.WhiteSettingInfo.AppName = enums.TestApp

+ 1 - 1
tracing/apm_tracing.go

@@ -140,7 +140,7 @@ func (t *Trace) TraceStartEvent(method, path, sn string, sport uint16, status l7
 		// buildAppMapFromEvent
 		// buildAppMapFromEvent
 		attribute.Int("server.code_type", appInfo.CodeType.Int()),
 		attribute.Int("server.code_type", appInfo.CodeType.Int()),
 		attribute.String("server.app_name", appInfo.AppName),
 		attribute.String("server.app_name", appInfo.AppName),
-		attribute.String("server.service_name", appInfo.ServiceName),
+		attribute.String("server.service_name", appInfo.ServiceType),
 		attribute.Int64("server.app_id", appInfo.AppIdHash.IntVal),
 		attribute.Int64("server.app_id", appInfo.AppIdHash.IntVal),
 		attribute.Int64("server.agent_id", appInfo.AgentId),
 		attribute.Int64("server.agent_id", appInfo.AgentId),
 		attribute.Int64("server.instance_id", appInfo.InstanceIdHash.IntVal),
 		attribute.Int64("server.instance_id", appInfo.InstanceIdHash.IntVal),

+ 7 - 0
utils/id.go

@@ -45,6 +45,13 @@ func GetAccountID() int {
 	return NODE_INFO.AccountID
 	return NODE_INFO.AccountID
 }
 }
 
 
+func GetHostIP() string {
+	if NODE_INFO != nil {
+		return NODE_INFO.HostIp
+	}
+	return ""
+}
+
 func GetHostID() int64 {
 func GetHostID() int64 {
 	if NODE_INFO != nil && NODE_INFO.HostID != 0 {
 	if NODE_INFO != nil && NODE_INFO.HostID != 0 {
 		return NODE_INFO.HostID
 		return NODE_INFO.HostID

+ 1 - 1
utils/modelse/app_info.go

@@ -35,7 +35,7 @@ type AppInfo struct {
 	AgentId        int64         `json:"agent_id"`
 	AgentId        int64         `json:"agent_id"`
 	Sn             string        `json:"sn"`
 	Sn             string        `json:"sn"`
 	Sport          int           `json:"sport"`
 	Sport          int           `json:"sport"`
-	ServiceName    string        `json:"service_name"`
+	ServiceType    string        `json:"service_name"`
 	CodeType       CodeType      `json:"code_type"`
 	CodeType       CodeType      `json:"code_type"`
 	EBPFProcInfo   *EbpfProcInfo `json:"ebpf_proc_info"`
 	EBPFProcInfo   *EbpfProcInfo `json:"ebpf_proc_info"`
 	RegisterAt     int64         `json:"register_at"`
 	RegisterAt     int64         `json:"register_at"`

+ 7 - 0
utils/modelse/models.go

@@ -122,6 +122,7 @@ type RegisterAppReq struct {
 	CodeType    int    `json:"codeType"`
 	CodeType    int    `json:"codeType"`
 	App_type    int    `json:"app_type"`
 	App_type    int    `json:"app_type"`
 	HostId      int64  `json:"hostId"`
 	HostId      int64  `json:"hostId"`
+	AppLang     string `json:"app_lang"`
 	//AppNameAnalysis []map[string]string `json:"app_name_analysis"`
 	//AppNameAnalysis []map[string]string `json:"app_name_analysis"`
 	//CwAppTransform  string              `json:"cw_app_transform"`
 	//CwAppTransform  string              `json:"cw_app_transform"`
 	//OrgCode         string              `json:"org_code"`
 	//OrgCode         string              `json:"org_code"`
@@ -280,6 +281,12 @@ type AgentInfo struct {
 	ProxyLocalIp string `json:"proxy_local_ip"`
 	ProxyLocalIp string `json:"proxy_local_ip"`
 }
 }
 
 
+type EbpfAppReq struct {
+	AccountId int `json:"account_id"`
+}
+
+type EbpfAppResp map[string]string
+
 type TaskStatus struct {
 type TaskStatus struct {
 	TaskId     string `json:"taskid"`
 	TaskId     string `json:"taskid"`
 	TaskStatus string `json:"taskStatus"`
 	TaskStatus string `json:"taskStatus"`

+ 17 - 0
utils/worker/serverWorker.go

@@ -37,6 +37,7 @@ type ServerWorker interface {
 
 
 	WhiteListV2(WhiteListReq) (WhiteDataV2, error)
 	WhiteListV2(WhiteListReq) (WhiteDataV2, error)
 
 
+	PullAllAppInfo(EbpfAppReq) (EbpfAppResp, error)
 	//SyncAgentInfo(RegistRequest) ([]AgentList, error)
 	//SyncAgentInfo(RegistRequest) ([]AgentList, error)
 
 
 	//Heart(DaemonHeartBeatInfo) (map[string]HeartConfContent, error)
 	//Heart(DaemonHeartBeatInfo) (map[string]HeartConfContent, error)
@@ -50,6 +51,22 @@ type ServerWorker interface {
 	//GetInfo() (string, string)
 	//GetInfo() (string, string)
 }
 }
 
 
+func (w *ServerHTTPWorker) PullAllAppInfo(request EbpfAppReq) (EbpfAppResp, error) {
+	log.Infof("[get all appinfo] request:%v.", utils.ToString(request))
+	response := EbpfAppResp{}
+	result, err := w.requestServer("/api/v70/ebpfAppInfo", request)
+	log.Infof("[get all appinfo] resp data:%v.", string(result))
+	if err != nil {
+		return response, err
+	}
+	err = json.Unmarshal(result, &response)
+	if err != nil {
+		log.WithError(err).Errorf("[get all appinfo] Failed get request:%v.", utils.ToString(request))
+		return response, err
+	}
+	return response, nil
+}
+
 func (w *ServerHTTPWorker) RegisterHost(request RegisterHostReq) error {
 func (w *ServerHTTPWorker) RegisterHost(request RegisterHostReq) error {
 	log.Infof("[server register host] request:%v.", utils.ToString(request))
 	log.Infof("[server register host] request:%v.", utils.ToString(request))
 	result, err := w.requestServer("/v2/app/registerHost", request)
 	result, err := w.requestServer("/v2/app/registerHost", request)