Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultDiagSet = NewDiagSet()
DefaultDiagSet is the default Set to use.
Functions ¶
This section is empty.
Types ¶
type CommandSource ¶
type CommandSource struct {
// contains filtered or unexported fields
}
CommandSource executes the specified command and returns the stdout contents as diagnostics info
func NewCommandSource ¶
func NewCommandSource(ext string, cmd []string) *CommandSource
NewCommandSource creates a new CommandSource.
func (*CommandSource) DiagnosticInfo ¶
func (s *CommandSource) DiagnosticInfo() (Result, error)
DiagnosticInfo implements DiagnosticInfo method of the Source interface.
type LogDirSource ¶
type LogDirSource struct {
// contains filtered or unexported fields
}
LogDirSource bundles together log files from the specified directory.
func NewLogDirSource ¶
func NewLogDirSource(logDir string) *LogDirSource
NewLogDirSource creates a new LogDirSource.
func (*LogDirSource) DiagnosticInfo ¶
func (s *LogDirSource) DiagnosticInfo() (Result, error)
DiagnosticInfo implements DiagnosticInfo method of the Source interface.
type Result ¶
type Result struct {
// Name is the name of the item sans extension.
Name string `json:"name,omitempty"`
// Ext is the file extension to use.
Ext string `json:"ext,omitempty"`
// Data is the content returned by the Source.
Data string `json:"data,omitempty"`
// IsDir specifies whether this diagnostics result
// needs to be unpacked to a directory.
IsDir bool `json:"isdir"`
// Children denotes the child items to be placed into the
// subdirectory that should be made for this Result during
// unpacking.
Children map[string]Result `json:"children,omitempty"`
// Error contains an error message in case if the Source
// has failed to provide the information.
Error string `json:"error,omitempty"`
}
Result denotes the result of a diagnostics run.
func DecodeDiagnostics ¶
DecodeDiagnostics loads the diagnostics info from the JSON data.
func RetrieveDiagnostics ¶
RetrieveDiagnostics retrieves the diagnostic info from the specified UNIX domain socket.
type Server ¶
Server denotes a diagnostics server that listens on a unix domain socket and spews out a piece of JSON content on a socket connection.
func NewServer ¶
NewServer makes a new diagnostics server using the specified Set. If diagSet is nil, DefaultDiagSet is used.
type Set ¶
Set denotes a set of diagnostics sources.
func (*Set) RegisterDiagSource ¶
RegisterDiagSource registers a diagnostics source.
func (*Set) RunDiagnostics ¶
RunDiagnostics collects the diagnostic information from all of the available sources.
type SimpleTextSource ¶
type SimpleTextSource struct {
// contains filtered or unexported fields
}
SimpleTextSource invokes the specified function that returns a string (and an error, if any) and wraps its result in Result
func NewSimpleTextSource ¶
func NewSimpleTextSource(ext string, toCall SimpleTextSourceFunc) *SimpleTextSource
NewSimpleTextSource creates a new SimpleTextSource.
func (*SimpleTextSource) DiagnosticInfo ¶
func (s *SimpleTextSource) DiagnosticInfo() (Result, error)
DiagnosticInfo implements DiagnosticInfo method of the Source interface.
type SimpleTextSourceFunc ¶
SimpleTextSourceFunc denotes a function that's invoked by SimpleTextSource to gather diagnostics info.
type Source ¶
type Source interface {
// DiagnosticInfo returns diagnostic information for the
// source. DiagnosticInfo() may skip setting Name in the
// Result, in which case it'll be set to the name used to
// register the source.
DiagnosticInfo() (Result, error)
}
Source speicifies a diagnostics information source
var StackDumpSource Source = stackDumpSource{}
StackDumpSource dumps Go runtime stack.