Documentation
¶
Index ¶
- Constants
- func Begin() func()
- func Collect(f func())
- func Enable() func()
- func MarshalAnyJSON(v interface{}) ([]byte, error)
- func Options() *collectOpts
- func SetMarshalStack(fn func(root *Root) ([]byte, error))
- func WriteFile(name string, data []byte, perm fs.FileMode) error
- type CollectOptions
- type ErrSilent
- type ExportOptions
- type FuncInfoExport
- type FuncKind
- type LimitSize
- type Root
- type RootExport
- type Stack
- type StackExport
Constants ¶
View Source
const DefaultAppearanceLimit = 100
default appearance limit on repeative functions
View Source
const DefaultSizeLimit = 16 * 1024
default size to shrink 16K
Variables ¶
This section is empty.
Functions ¶
func Collect ¶
func Collect(f func())
executes f and collect its trace by default trace output will be controlled by XGO_TRACE_OUTPUT
func Enable ¶
func Enable() func()
Enable setup the trace interceptor if called from init, the interceptor is enabled globally. Otherwise locally
func MarshalAnyJSON ¶
MarshalAnyJSON marshals aribitray go value `v` to JSON, when it encounters unmarshalable values like func, chan, it will bypass these values.
func SetMarshalStack ¶
Types ¶
type CollectOptions ¶
type ErrSilent ¶
type ErrSilent struct {
Data interface{}
}
make json err silent
func (*ErrSilent) MarshalJSON ¶
type ExportOptions ¶
type ExportOptions struct {
// suppress error when marshalling
// arguments and results
DisableErrSilent bool
SizeLimit int // 0: default limit 16K
AppearanceLimit int // 0: default limit 100
FilterStack func(stack *StackExport) *StackExport
FilterRoot func(root *RootExport) *RootExport
MarshalRoot func(root *RootExport) ([]byte, error)
// contains filtered or unexported fields
}
allow skip some packages
for example: google.golang.org/protobuf/internal/order
type FuncInfoExport ¶
type FuncInfoExport struct {
// FullName string
Kind FuncKind
Pkg string
IdentityName string
Name string
RecvType string
RecvPtr bool
// interface method?
Interface bool
Generic bool
Closure bool
Stdlib bool
File string
Line int
RecvName string
ArgNames []string
ResNames []string
// is first argument ctx
FirstArgCtx bool
// last result error
LastResultErr bool
}
func ExportFuncInfo ¶
func ExportFuncInfo(c *core.FuncInfo, opts *ExportOptions) *FuncInfoExport
type LimitSize ¶
type LimitSize struct {
Data interface{}
Limit int
}
make json err silent
func (*LimitSize) MarshalJSON ¶
type Root ¶
func (*Root) Export ¶
func (c *Root) Export(opts *ExportOptions) *RootExport
type RootExport ¶
type RootExport struct {
// current executed function
Begin time.Time
Children []*StackExport
}
type Stack ¶
type Stack struct {
FuncInfo *core.FuncInfo
Begin int64 // us
End int64 // us
Args core.Object
Results core.Object
// is recorded as snapshot
Snapshot bool
Panic bool
Error error
Children []*Stack
}
func (*Stack) Export ¶
func (c *Stack) Export(opts *ExportOptions) *StackExport
type StackExport ¶
type StackExport struct {
FuncInfo *FuncInfoExport
Begin int64 // us
End int64 // us
Args interface{}
Results interface{}
// is recorded as snapshot
Snapshot bool
Panic bool
Error string
Children []*StackExport
}
Click to show internal directories.
Click to hide internal directories.