|
|
@@ -56,23 +56,23 @@ func (c *Container) getOrInitTrace(traceId uint64) (*tracing.Trace, error) {
|
|
|
}
|
|
|
|
|
|
// Deprecated: InitTrace not used
|
|
|
-func (c *Container) InitTrace(traceId uint64, r *l7.RequestData) error {
|
|
|
- method, path, hostIp, port := l7.ParseHttpHost(r.Payload)
|
|
|
- ip, err := netaddr.ParseIP(hostIp)
|
|
|
- if err != nil {
|
|
|
- //fmt.Println("host ip error")
|
|
|
- hostIp = "127.0.0.1"
|
|
|
- }
|
|
|
- addr := netaddr.IPPortFrom(ip, port)
|
|
|
- trace := tracing.NewTrace(string(c.id), addr)
|
|
|
- if trace == nil {
|
|
|
- return fmt.Errorf("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT is null")
|
|
|
- }
|
|
|
- c.traceMap[traceId] = trace
|
|
|
-
|
|
|
- trace.TraceStart(method, path, r.Status, r.Duration)
|
|
|
- return nil
|
|
|
-}
|
|
|
+//func (c *Container) InitTrace(traceId uint64, r *l7.RequestData) error {
|
|
|
+// method, path, hostIp, port := l7.ParseHttpHost(r.Payload)
|
|
|
+// ip, err := netaddr.ParseIP(hostIp)
|
|
|
+// if err != nil {
|
|
|
+// //fmt.Println("host ip error")
|
|
|
+// hostIp = "127.0.0.1"
|
|
|
+// }
|
|
|
+// addr := netaddr.IPPortFrom(ip, port)
|
|
|
+// trace := tracing.NewTrace(string(c.id), addr)
|
|
|
+// if trace == nil {
|
|
|
+// return fmt.Errorf("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT is null")
|
|
|
+// }
|
|
|
+// c.traceMap[traceId] = trace
|
|
|
+//
|
|
|
+// trace.TraceStart(method, path, r.Status, r.Duration)
|
|
|
+// return nil
|
|
|
+//}
|
|
|
|
|
|
// 在任意阶段,r.TraceId 不等于0 则创建 traceMap && createParentSpan
|
|
|
// 更新 createTraceSpan 机制,更新触发traceEnd机制,当事件个数满足时,任意event均可触发end
|
|
|
@@ -120,7 +120,7 @@ func (c *Container) onL7RequestApm(pid uint32, fd uint64, timestamp uint64, r *l
|
|
|
klog.Debugf("->>> [%s] -> payload:[%s]", c.AppInfo.AppName, r.Payload)
|
|
|
}
|
|
|
if err == nil {
|
|
|
- method, requestURI, sn, sport := l7.ParseHttpHost(r.Payload)
|
|
|
+ method, requestURI, sn, sport := l7.ParseHttpHost(r.Payload, r.IsTls)
|
|
|
ip, _ := netaddr.ParseIP(sn)
|
|
|
//codeType := c.GetCodeTypeFromCache(pid)
|
|
|
container_id := ""
|
|
|
@@ -145,7 +145,7 @@ func (c *Container) onL7RequestApm(pid uint32, fd uint64, timestamp uint64, r *l
|
|
|
}
|
|
|
if r.Protocol == l7.ProtocolHTTP {
|
|
|
if c.l7Attach && c.valuableTrace(r.TraceId) {
|
|
|
- method, requestURI, sn, sport := l7.ParseHttpHost(r.Payload)
|
|
|
+ method, requestURI, sn, sport := l7.ParseHttpHost(r.Payload, r.IsTls)
|
|
|
apmTrace, err := c.getOrInitTrace(r.TraceId)
|
|
|
//fmt.Println("ProtocolHTTP-----", r.TraceId, err)
|
|
|
if err == nil {
|