instrument

package
v0.0.4-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2025 License: AGPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOG_LEVEL  = slog.LevelDebug
	LOG_ARG    = true
	LOG_RETURN = true
	LOG_METRIC = true
)

Variables

View Source
var CTXSTK map[int][]context.Context
View Source
var CtxChan chan hookFunctionParameterListT = make(chan hookFunctionParameterListT, 100)
View Source
var GLOBALCTX = context.Background()
View Source
var LoadFullValue = proc.LoadConfig{true, 1, 64, 64, -1, 0}

TODO in the future we extend this part to be more flexiable to user

View Source
var SPANSTK map[int][]traceSpan.Span
View Source
var (
	TRACE_FUNC = true
)

Functions

func Collect

func Collect(bi *proc.BinaryInfo, ctxCh chan hookFunctionParameterListT)

func CollectEnd

func CollectEnd(bi *proc.BinaryInfo, ctx hookFunctionParameterListT) (string, []*proc.Variable)

func CollectEntry

func CollectEntry(bi *proc.BinaryInfo, ctx hookFunctionParameterListT) (string, []*proc.Variable)

func GetFunctionByPrefix

func GetFunctionByPrefix(bi *proc.BinaryInfo, prefix string) []*proc.Function

func GetFunctionParameter

func GetFunctionParameter(bi *proc.BinaryInfo, f *proc.Function, addr uint64, getRet bool) ([]proc.Parameter, error)

getRet decide this function return parameter or return parameter

func GetParametersFromCtx

func GetParametersFromCtx(ctx hookFunctionParameterListT) []proc.Parameter

func GetRegisterFromCtx

func GetRegisterFromCtx(ctx hookFunctionParameterListT) *op.DwarfRegisters

func GetVariablesFromCtx

func GetVariablesFromCtx(fn *proc.Function, ctx hookFunctionParameterListT, bi *proc.BinaryInfo, getRet bool) ([]*proc.Variable, error)

func InitializeTracer

func InitializeTracer(serviceName string, collectorAddress string) error

func PrintCtx

func PrintCtx(head string, ctx hookFunctionParameterListT)

func PrintV

func PrintV(ident string, v proc.Variable)

func ReadPerf

func ReadPerf(event *ebpf.Map, ctxCh chan hookFunctionParameterListT)

Read value from perf event

func StartSpan

func StartSpan(operationName string, goid int, parentid int, variables []*proc.Variable)

func StopSpan

func StopSpan(goid int, variables []*proc.Variable)

func TraceDefer

func TraceDefer(ctx hookFunctionParameterListT, variables []*proc.Variable)

func TraceEntry

func TraceEntry(functionName string, ctx hookFunctionParameterListT, variables []*proc.Variable)

func TraceDefer(ctx context.Context) { }

Types

type GOID

type GOID int

type Instrument

type Instrument struct {
	FunctionManager *internal.FunctionManager
	// contains filtered or unexported fields
}

func GetInstrument

func GetInstrument() *Instrument

func NewInstrument

func NewInstrument(binaryPath string) *Instrument

func (*Instrument) ProbeFunctionWithPrefix

func (i *Instrument) ProbeFunctionWithPrefix(prefix string) []string

func (Instrument) Start

func (i Instrument) Start() error

func (Instrument) Stop

func (i Instrument) Stop()

func (*Instrument) UnProbeFunctionWithPrefix

func (i *Instrument) UnProbeFunctionWithPrefix(prefix string) []string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL