Documentation
¶
Index ¶
- type Engine
- func (e *Engine) Capture(service, profileType string, duration time.Duration) (*Profile, error)
- func (e *Engine) FilePath(id string) (string, error)
- func (e *Engine) FindRelevant(service string, around time.Time) []Profile
- func (e *Engine) FoldedStacks(id string) (string, error)
- func (e *Engine) Get(id string) (*Profile, error)
- func (e *Engine) List(service string) ([]Profile, error)
- type Profile
- type SpanStack
- type StackFrame
- type Symbolizer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine manages capture, storage, and retrieval of runtime profiles.
func New ¶
New creates a profiling engine that stores profiles in profileDir. maxProfiles controls the circular buffer size; oldest profiles are evicted when exceeded.
func (*Engine) Capture ¶
Capture takes a runtime profile of the given type for the named service. Supported types: "cpu", "heap", "goroutine".
func (*Engine) FindRelevant ¶
FindRelevant returns profiles for a service captured within 5 minutes of the given time.
func (*Engine) FoldedStacks ¶
FoldedStacks reads a captured pprof profile by ID and converts it to folded stack format suitable for flame graph generation. Each line has the format: "func1;func2;func3 count".
type Profile ¶
type Profile struct {
ID string `json:"id"`
Service string `json:"service"`
Type string `json:"type"`
FilePath string `json:"-"`
CapturedAt time.Time `json:"captured_at"`
Duration time.Duration `json:"duration,omitempty"`
Size int64 `json:"size_bytes"`
}
Profile represents a captured runtime profile (CPU, heap, goroutine).
type SpanStack ¶
type SpanStack struct {
Point string `json:"point"`
Frames []StackFrame `json:"frames"`
}
SpanStack captures the call stack at a named point.
func CaptureStack ¶
CaptureStack captures the current goroutine's call stack at the named point. skip controls how many additional caller frames to skip (0 = caller of CaptureStack).
type StackFrame ¶
type StackFrame struct {
Function string `json:"function"`
File string `json:"file"`
Line int `json:"line"`
Module string `json:"module,omitempty"`
}
StackFrame represents a single frame in a call stack.
type Symbolizer ¶
type Symbolizer struct {
// contains filtered or unexported fields
}
Symbolizer parses Source Map v3 format and resolves generated file:line to original file:line.
func NewSymbolizer ¶
func NewSymbolizer() *Symbolizer
NewSymbolizer returns an initialised Symbolizer.
func (*Symbolizer) LoadMap ¶
func (s *Symbolizer) LoadMap(filePath string, mapData []byte) error
LoadMap loads a source map for the given generated file path.
func (*Symbolizer) Symbolicate ¶
func (s *Symbolizer) Symbolicate(frames []StackFrame) []StackFrame
Symbolicate resolves generated frames to original source locations. Frames without matching source maps pass through unchanged.