@@ -15,6 +15,10 @@ import (
15
15
)
16
16
17
17
func MyServer (server * http.ServeMux , w http.ResponseWriter , r * http.Request ) {
18
+ worker , _ := utils .NewWorker (global .AgentId )
19
+
20
+ TraceId := global .TraceId + "-" + strconv .Itoa (int (worker .GetId ()))
21
+ global .TargetTraceId = TraceId
18
22
MyServerTemp (server , w , r )
19
23
id := utils .CatGoroutineID ()
20
24
go func () {
@@ -24,7 +28,7 @@ func MyServer(server *http.ServeMux, w http.ResponseWriter, r *http.Request) {
24
28
for k , v := range r .Header {
25
29
headerBase += k + ": " + strings .Join (v , "," ) + "\n "
26
30
}
27
- tranceID := global . TraceId + "." + strconv .Itoa (global .AgentId ) + ".0.0.0"
31
+ tranceID := TraceId + "." + strconv .Itoa (global .AgentId ) + ".0.0.0"
28
32
headerBase += "dt-traceid:" + tranceID
29
33
if t .Kind () == reflect .Ptr {
30
34
buf := t .
@@ -51,7 +55,6 @@ func MyServer(server *http.ServeMux, w http.ResponseWriter, r *http.Request) {
51
55
if r .TLS != nil {
52
56
scheme = "https"
53
57
}
54
- worker , _ := utils .NewWorker (global .AgentId )
55
58
onlyKey := int (worker .GetId ())
56
59
57
60
HookGroup := & request.UploadReq {
@@ -71,6 +74,7 @@ func MyServer(server *http.ServeMux, w http.ResponseWriter, r *http.Request) {
71
74
ReqBody : body ,
72
75
QueryString : r .URL .RawQuery ,
73
76
Pool : []request.Pool {},
77
+ TraceId : tranceID ,
74
78
},
75
79
},
76
80
}
@@ -96,7 +100,7 @@ func MyServer(server *http.ServeMux, w http.ResponseWriter, r *http.Request) {
96
100
global .PoolTreeMap .Range (func (key , value interface {}) bool {
97
101
if value .(* request.PoolTree ).IsThisBegin (id ) {
98
102
global .PoolTreeMap .Delete (key )
99
- value .(* request.PoolTree ).FMT (& HookGroup .Detail .Function .Pool , worker , goroutineIDs , "" )
103
+ value .(* request.PoolTree ).FMT (& HookGroup .Detail .Function .Pool , worker , goroutineIDs , HookGroup . Detail . Function . TraceId )
100
104
return false
101
105
}
102
106
return true
0 commit comments