instrument

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package instrument rewrites Go source files to insert tracing calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Rewrite

func Rewrite(src []byte) ([]byte, error)

Rewrite parses the given Go source and inserts tracing instrumentation. It handles:

  • Function/method tracing (Enter/Exit)
  • sql.Open → gotraceruntime.OpenDB
  • http.ListenAndServe handler wrapping

Types

type Injector

type Injector struct {
	// contains filtered or unexported fields
}

Injector walks a Go project, rewrites matching files with tracing instrumentation, and writes the result to a temporary directory.

func NewInjector

func NewInjector(cfg config.Config) Injector

NewInjector creates an injector with the given config.

func (Injector) Inject

func (inj Injector) Inject(srcDir string) (string, error)

Inject copies the project at srcDir into a temporary directory, rewrites matching Go files with tracing calls, and returns the path to the instrumented project.

Jump to

Keyboard shortcuts

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