processor

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicSpanName

func BasicSpanName(receiver, function string) string

BasicSpanName is common notation of <class>.<method> or <pkg>.<func>

Types

type Instrumenter

type Instrumenter interface {
	Imports() []*types.Package
	PrefixStatements(spanName string, contextName string, hasError bool, errName string) []ast.Stmt
}

Instrumenter supplies ast of Go code that will be inserted and required dependencies.

type Processor

type Processor struct {
	Instrumenter                Instrumenter
	PreserveLineNumbers         bool // if true, use compile directives to preserve line numbers as if no instrumentation was applied
	SpanName                    func(receiver, function string) string
	ContextPackage, ContextType string // context is detected automatically based on matching package and symbol name
	ErrorType                   string // error is detected by error type
}

Processor traverses AST, collects details on functions and methods, and invokes Instrumenter

func (*Processor) Process

func (p *Processor) Process(fset *token.FileSet, file *ast.File) error