Documentation
¶
Overview ¶
Package dump reads Go goroutine dumps and finds what looks stuck.
Index ¶
Constants ¶
const ( FormatTraceback = "traceback" // debug=2, a panic, or SIGQUIT FormatProfile = "profile" // debug=1 )
Formats of a dump.
const ( High = "high" Medium = "medium" Low = "low" )
Severities of a finding.
const Unknown = "unknown"
Unknown is the state of a debug=1 goroutine whose stack doesn't show what it waits on.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct {
Where string `json:"where"`
State string `json:"state"`
Before int `json:"before"`
After int `json:"after"`
Delta int `json:"delta"`
}
Change is how one stack's count moved between two dumps.
type Comparison ¶
type Comparison struct {
Before int `json:"before_total"`
After int `json:"after_total"`
Growing []Change `json:"growing"`
Shrinking []Change `json:"shrinking"`
Parked []Parked `json:"parked"`
// ParkedElsewhere counts goroutines that stayed in place at stacks that aren't growing, which long-running loops do.
ParkedElsewhere int `json:"parked_elsewhere"`
New []Finding `json:"new_findings"`
Fixed []Finding `json:"fixed_findings"`
Remaining []Finding `json:"remaining_findings"`
Notes []string `json:"notes,omitempty"`
}
Comparison is what changed between two dumps of one program.
func Compare ¶
func Compare(before, after *Dump) Comparison
Compare shows what moved between two dumps. A count that keeps growing, and goroutine IDs that never leave one place, are stronger evidence than one dump.
type Finding ¶
type Finding struct {
ID string `json:"id"`
Severity string `json:"severity"`
Where string `json:"where"`
Count int `json:"count"`
Message string `json:"message"`
Try string `json:"try,omitempty"`
}
Finding is one lead from a dump.
type Frame ¶
type Frame struct {
Func string `json:"func"`
File string `json:"file,omitempty"`
Line int `json:"line,omitempty"`
Args string `json:"args,omitempty"`
}
Frame is one line of a stack.
type Goroutine ¶
type Goroutine struct {
ID int
Count int
State string
WaitMinutes int
Locked bool
Leaked bool
Frames []Frame
CreatedBy string
CreatedAt string
Elided bool
}
Goroutine is one goroutine, or in a debug=1 dump, a group with one stack.
type Group ¶
type Group struct {
Count int `json:"count"`
State string `json:"state"`
MaxWaitMinutes int `json:"max_wait_minutes,omitempty"`
MinWaitMinutes int `json:"min_wait_minutes,omitempty"`
Where string `json:"where"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
Expected bool `json:"expected,omitempty"`
IDs []int `json:"ids,omitempty"`
Stack []string `json:"stack"`
// contains filtered or unexported fields
}
Group is a set of goroutines with the same state and stack.
type Parked ¶
type Parked struct {
Where string `json:"where"`
State string `json:"state"`
Count int `json:"count"`
MaxWaitMinutes int `json:"max_wait_minutes,omitempty"`
Growing bool `json:"growing,omitempty"`
// contains filtered or unexported fields
}
Parked is a set of goroutines seen in both dumps at the same place.
type Review ¶
type Review struct {
Format string `json:"format"`
Total int `json:"total"`
Expected int `json:"expected_idle"`
Fatal string `json:"fatal,omitempty"`
Signal string `json:"signal,omitempty"`
States []StateCount `json:"states"`
Findings []Finding `json:"findings"`
Groups []Group `json:"groups"`
GroupCount int `json:"group_count"`
Notes []string `json:"notes,omitempty"`
}
Review is what a dump shows.
func (Review) HasFindingAt ¶
HasFindingAt reports whether a review has a finding at any of these severities.
type StateCount ¶
StateCount is how many goroutines are in a state.