Skip to content

Commit a40cfef

Browse files
committed
misc
1 parent 64d56ab commit a40cfef

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

scouterx/netio/tracecontext.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
type TraceContext struct {
1212
Closed bool
13+
Noop bool
1314
LastMethod string
1415
IsStream bool
1516

@@ -84,6 +85,16 @@ func NewTraceContext() *TraceContext {
8485
return context
8586
}
8687

88+
func NewNoopTraceContext() *TraceContext {
89+
context := new(TraceContext)
90+
context.Txid = -1
91+
context.Noop = true
92+
context.Text5 = "NoopTctx"
93+
context.StartTime = time.Now()
94+
context.Profile = NewProfileCollector(context)
95+
return context
96+
}
97+
8798
func (tctx (TraceContext)) ToXlog(discardType netdata.XlogDiscardType, elapsed int32) *netdata.XlogPack {
8899
xlog := netdata.NewXlogPack()
89100
xlog.Elapsed = elapsed
@@ -101,7 +112,7 @@ func (tctx (TraceContext)) ToXlog(discardType netdata.XlogDiscardType, elapsed i
101112
xlog.Error = tctx.Error
102113

103114
xlog.Status = tctx.Status
104-
115+
105116
xlog.DiscardType = discardType
106117
xlog.ProfileSize = int32(tctx.ProfileSize)
107118
xlog.ProfileCount = int32(tctx.ProfileCount)

scouterx/strace/tctxmanager/tctxmanager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +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()
20+
var noopTctx = netio.NewNoopTraceContext()
2121

2222
func RegisterEndStuckServiceForciblyFunc(f func(tctx *netio.TraceContext)) {
2323
fEndStuckServiceForcibly = f

scouterx/strace/tracemain.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ func EndService(ctx context.Context) {
222222
}
223223

224224
func StartNewInheritanceService(ctx context.Context, parentTctx *netio.TraceContext) (newCtx context.Context, newTctx *netio.TraceContext) {
225+
//TODO ctx를 전달받지 않아야 될 것 같긴한데...
225226
common.ReportScouterPanic()
226227
if ctx == nil {
227228
ctx = context.Background()

0 commit comments

Comments
 (0)