Selaa lähdekoodia

Feature #TASK_QT-18250 1、解决容器场景,grpc-client采集到数据,但是无法上报的问题。

rock 7 kuukautta sitten
vanhempi
säilyke
5ae2f7f149
1 muutettua tiedostoa jossa 22 lisäystä ja 0 poistoa
  1. 22 0
      containers/container_apm.go

+ 22 - 0
containers/container_apm.go

@@ -174,9 +174,31 @@ func (c *Container) onL7RequestApm(pid uint32, fd uint64, timestamp uint64, r *l
 	//fmt.Println("l7.connectionsByPidFd", conn, pid, fd)
 
 	if conn == nil {
+		if r.Protocol == l7.ProtocolGrpc {
+			klog.Infoln("conn == nil r.Protocol == l7.ProtocolGrpc")
+			klog.Infoln("enter the l7.ProtocolGrpc")
+			if c.l7Attach && c.valuableTrace(r.TraceId) {
+				apmTrace, err := c.getOrInitTrace(r.TraceId)
+				if err == nil {
+					apmTrace.GrpcClientTraceQueryEvent(r)
+					c.SendEvent(apmTrace, r.TraceId)
+				}
+			}
+		}
 		return nil
 	}
 	if timestamp != 0 && conn.Timestamp != timestamp {
+		if r.Protocol == l7.ProtocolGrpc {
+			klog.Infoln("timestamp != 0 && conn.Timestamp != timestamp r.Protocol == l7.ProtocolGrpc")
+			klog.Infoln("enter the l7.ProtocolGrpc")
+			if c.l7Attach && c.valuableTrace(r.TraceId) {
+				apmTrace, err := c.getOrInitTrace(r.TraceId)
+				if err == nil {
+					apmTrace.GrpcClientTraceQueryEvent(r)
+					c.SendEvent(apmTrace, r.TraceId)
+				}
+			}
+		}
 		return nil
 	}
 	stats := c.l7Stats.get(r.Protocol, conn.Dest, conn.ActualDest)