Skip to content

Commit 677068f

Browse files
committed
add IsStream prop on tctx
1 parent 19b6ff2 commit 677068f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

scouterx/netio/tracecontext.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
type TraceContext struct {
1212
Closed bool
1313
LastMethod string
14+
IsStream bool
1415

1516
Goid int
1617
Parent *TraceContext

scouterx/strace/tracemain.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,31 @@ func goid() int {
3737
return id
3838
}
3939

40+
func IsStream(ctx context.Context) bool {
41+
common.ReportScouterPanic()
42+
if ctx == nil {
43+
return false
44+
}
45+
tctx := tctxmanager.GetTraceContext(ctx)
46+
if tctx == nil {
47+
return false
48+
}
49+
return tctx.IsStream
50+
}
51+
52+
func SetAsStream(ctx context.Context) bool {
53+
common.ReportScouterPanic()
54+
if ctx == nil {
55+
return false
56+
}
57+
tctx := tctxmanager.GetTraceContext(ctx)
58+
if tctx == nil {
59+
return false
60+
}
61+
tctx.IsStream = true
62+
return true
63+
}
64+
4065
func MarkAsError(ctx context.Context, errorMessage string) {
4166
common.ReportScouterPanic()
4267
if ctx == nil {

0 commit comments

Comments
 (0)