Documentation ¶
Overview ¶
Package diag implements functions for dumping crash information into various formats.
Index ¶
- Constants
- func AsJson(diagData *DiagData) string
- func AsString(diagData *DiagData) string
- func FmtMallocStatsStr(data *runtime.MemStats) string
- func FmtMemStatsStr(data *runtime.MemStats) string
- func InitWebDiag()
- func NewBlockedData() string
- func NewMemData() *runtime.MemStats
- func NewStackString() string
- type DiagData
- type EnvData
- type StackFrame
- type StackTrace
- type SysData
- type UriInfo
Constants ¶
const STACK_BUFFERS = 2045
Maximum number of stack records to hold.
const TRACE_BUFFER_LEN_B = 1 * 1024 * 1024 // 1MB
Buffer size, in bytes, for storing stack traces.
Variables ¶
This section is empty.
Functions ¶
func AsJson ¶
AsJson aggregates and returns diagnostics information in json format. Diagnostic information includes hostname, CPU count, environment data, stack traces for all running goroutines, and memory allocation statistics.
func AsString ¶
AsString aggregates and returns text-based diagnostics information. Diagnostic information includes hostname, CPU count, environment data, stack traces for all running goroutines, and memory allocation statistics.
func FmtMallocStatsStr ¶
FmtMallocStatsStr outputs the extended malloc information from a given MemStats instance as basic text.
func FmtMemStatsStr ¶
FmtMemStatsStr dumps memory allocation statistics and formats it as text. Malloc information is not included for brevity. Get it by calling FmtMallocStatsStr.
func InitWebDiag ¶
func InitWebDiag()
InitWebDiag initializes the web diag uris within an active web server.
func NewBlockedData ¶
func NewBlockedData() string
NewBlockData returns call stack information for any go routines which are currently blocking.
func NewMemData ¶
NewMemData creates and populates a new runtime.MemStats object and returns a pointer to it for use.
func NewStackString ¶
func NewStackString() string
NewStackString dumps stack traces for all active go routines.
Types ¶
type DiagData ¶
type DiagData struct { System *SysData Environment *EnvData Perfs *perf.Snapshot StackTrace []*StackTrace Memory *runtime.MemStats }
DiagData represents all aggregated diagnostic information.
type EnvData ¶
EnvData represents keyval pairs in the environment.
func NewEnvData ¶
func NewEnvData() *EnvData
NewEnvData creates and populates a new EnvData object and returns a pointer to it for use.
type StackFrame ¶
StackFrame represents the function name, file and line number information for a given frame within a stack trace.
func (*StackFrame) String ¶
func (this *StackFrame) String() string
String pretty-prints a StackFrame object.
type StackTrace ¶
type StackTrace struct {
Frames []*StackFrame
}
StackTrace represents the collection of stack frame data associated with a single goroutine.
func NewStackTrace ¶
func NewStackTrace() []*StackTrace
NewStackTrace is a constructor function which queries the Go runtime for goroutine information and builds a StackTrace object for each. A slice of StackTraces, one for each running goroutine, is returned.
func (*StackTrace) String ¶
func (this *StackTrace) String() string
String pretty-prints a StackTrace object.
type SysData ¶
type SysData struct { Arch string CGOCalls int64 CPUCount int Error string GoRoutines int GoVersion string Hostname string OS string }
SysData represents basic information about the system.
func NewSysData ¶
func NewSysData() *SysData
NewSysData creatse and populates a new SysData object and returns a pointer to it for use.