Skip to content

Commit ae72b66

Browse files
committed
misc
1 parent 7e3f3b9 commit ae72b66

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

scouterx/strace/tctxmanager/tctxmanager.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var ac = conf.GetInstance()
1717
var txidMap = cachemap.New(10000)
1818

1919
var fEndStuckServiceForcibly func(tctx *netio.TraceContext)
20+
var noopTctx = netio.NewTraceContext()
2021

2122
func RegisterEndStuckServiceForciblyFunc(f func(tctx *netio.TraceContext)) {
2223
fEndStuckServiceForcibly = f
@@ -27,6 +28,13 @@ func Size() int {
2728
return 0
2829
}
2930

31+
func GetTraceContextFallbackNoop(ctx context.Context) *netio.TraceContext {
32+
tctx := GetTraceContext(ctx)
33+
if tctx == nil {
34+
return noopTctx
35+
}
36+
}
37+
3038
func GetTraceContext(ctx context.Context) *netio.TraceContext {
3139
traceContext, ok := ctx.Value(tctxKey).(*netio.TraceContext)
3240
if ok {

scouterx/strace/tracemain.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,4 +479,3 @@ func profileHttpHeaders(r http.Request, tctx *netio.TraceContext) {
479479
tctx.Profile.Add(netdata.NewMessageStep(fmt.Sprintf("query: %s", r.URL.RawQuery), startTime))
480480
}
481481
}
482-

0 commit comments

Comments
 (0)