Documentation ¶
Overview ¶
The monitoring package supports three kinds of system monitoring.
They are helpful to understand what's happening inside a system during runtime. So execution times can be measured and analyzed, stay-set indicators integrated and dynamic control value retrieval provided.
Index ¶
- Constants
- func DecrVariable(id string)
- func DynamicStatusValuesDo(f func(*DynamicStatusValue)) error
- func DynamicStatusValuesPrintAll() error
- func DynamicStatusValuesWrite(w io.Writer, ff func(*DynamicStatusValue) bool) error
- func IncrVariable(id string)
- func IsDynamicStatusNotExistsError(err error) bool
- func IsMeasuringPointNotExistsError(err error) bool
- func IsMonitorCannotBeRecoveredError(err error) bool
- func IsMonitorPanickedError(err error) bool
- func IsStaySetVariableNotExistsError(err error) bool
- func Measure(id string, f func()) time.Duration
- func MeasuringPointsDo(f func(*MeasuringPoint)) error
- func MeasuringPointsPrintAll() error
- func MeasuringPointsWrite(w io.Writer, ff func(*MeasuringPoint) bool) error
- func ReadStatus(id string) (string, error)
- func Register(id string, rf DynamicStatusRetriever)
- func Reset() error
- func SetVariable(id string, v int64)
- func StaySetVariablesDo(f func(*StaySetVariable)) error
- func StaySetVariablesPrintAll() error
- func StaySetVariablesWrite(w io.Writer, ff func(*StaySetVariable) bool) error
- type DynamicStatusRetriever
- type DynamicStatusValue
- type DynamicStatusValues
- type Measuring
- type MeasuringPoint
- type MeasuringPoints
- type StaySetVariable
- type StaySetVariables
Constants ¶
const ( ErrMonitorPanicked = iota + 1 ErrMonitorCannotBeRecovered ErrMeasuringPointNotExists ErrStaySetVariableNotExists ErrDynamicStatusNotExists )
Variables ¶
This section is empty.
Functions ¶
func DynamicStatusValuesDo ¶
func DynamicStatusValuesDo(f func(*DynamicStatusValue)) error
DynamicStatusValuesDo performs the function f for all status values.
func DynamicStatusValuesPrintAll ¶
func DynamicStatusValuesPrintAll() error
DynamicStatusValuesPrintAll prints all status values to STDOUT.
func DynamicStatusValuesWrite ¶
func DynamicStatusValuesWrite(w io.Writer, ff func(*DynamicStatusValue) bool) error
DynamicStatusValuesWrite prints the status values for which the passed function returns true to the passed writer.
func IsDynamicStatusNotExistsError ¶
IsDynamicStatusNotExistsError returns true, if the error signals that a wanted dynamic status cannot be retrieved because it doesn't exists.
func IsMeasuringPointNotExistsError ¶
IsMeasuringPointNotExistsError returns true, if the error signals that a wanted measuring point cannot be retrieved because it doesn't exists.
func IsMonitorCannotBeRecoveredError ¶
IsMonitorCannotBeRecoveredError returns true, if the error signals that the monitor backend has panicked to often and cannot be recovered.
func IsMonitorPanickedError ¶
IsMonitorPanickedError returns true, if the error signals that the monitor backend panicked.
func IsStaySetVariableNotExistsError ¶
IsStaySetVariableNotExistsError returns true, if the error signals that a wanted stay-set variable cannot be retrieved because it doesn't exists.
func MeasuringPointsDo ¶
func MeasuringPointsDo(f func(*MeasuringPoint)) error
MeasuringPointsDo performs the function f for all measuring points.
func MeasuringPointsPrintAll ¶
func MeasuringPointsPrintAll() error
MeasuringPointsPrintAll prints all measuring points to STDOUT.
func MeasuringPointsWrite ¶
func MeasuringPointsWrite(w io.Writer, ff func(*MeasuringPoint) bool) error
MeasuringPointsWrite prints the measuring points for which the passed function returns true to the passed writer.
func ReadStatus ¶
ReadStatus returns the dynamic status for an id.
func Register ¶
func Register(id string, rf DynamicStatusRetriever)
Register registers a new dynamic status retriever function.
func SetVariable ¶
SetVariable sets a value of a stay-set variable.
func StaySetVariablesDo ¶
func StaySetVariablesDo(f func(*StaySetVariable)) error
StaySetVariablesDo performs the function f for all variables.
func StaySetVariablesPrintAll ¶
func StaySetVariablesPrintAll() error
StaySetVariablesPrintAll prints all stay-set variables to STDOUT.
func StaySetVariablesWrite ¶
func StaySetVariablesWrite(w io.Writer, ff func(*StaySetVariable) bool) error
StaySetVariablesWrite prints the stay-set variables for which the passed function returns true to the passed writer.
Types ¶
type DynamicStatusRetriever ¶
DynamicStatusRetriever is called by the server and returns a current status as string.
type DynamicStatusValue ¶
DynamicStatusValue contains one retrieved value.
type DynamicStatusValues ¶
type DynamicStatusValues []*DynamicStatusValue
DynamicStatusValues is a set of dynamic status values.
func (DynamicStatusValues) Len ¶
func (d DynamicStatusValues) Len() int
func (DynamicStatusValues) Less ¶
func (d DynamicStatusValues) Less(i, j int) bool
func (DynamicStatusValues) Swap ¶
func (d DynamicStatusValues) Swap(i, j int)
type Measuring ¶
type Measuring struct {
// contains filtered or unexported fields
}
Measuring contains one measuring.
func BeginMeasuring ¶
BeginMeasuring starts a new measuring with a given id. All measurings with the same id will be aggregated.
func (*Measuring) EndMeasuring ¶
EndMEasuring ends a measuring and passes it to the measuring server in the background.
type MeasuringPoint ¶
type MeasuringPoint struct { Id string Count int64 MinDuration time.Duration MaxDuration time.Duration AvgDuration time.Duration }
MeasuringPoint contains the cumulated measuring data of one measuring point.
func ReadMeasuringPoint ¶
func ReadMeasuringPoint(id string) (*MeasuringPoint, error)
ReadMeasuringPoint returns the measuring point for an id.
func (MeasuringPoint) String ¶
func (mp MeasuringPoint) String() string
String implements the Stringer interface.
type MeasuringPoints ¶
type MeasuringPoints []*MeasuringPoint
MeasuringPoints is a set of measuring points.
func (MeasuringPoints) Len ¶
func (m MeasuringPoints) Len() int
func (MeasuringPoints) Less ¶
func (m MeasuringPoints) Less(i, j int) bool
func (MeasuringPoints) Swap ¶
func (m MeasuringPoints) Swap(i, j int)
type StaySetVariable ¶
type StaySetVariable struct { Id string Count int64 ActValue int64 MinValue int64 MaxValue int64 AvgValue int64 // contains filtered or unexported fields }
StaySetVariable contains the cumulated values for one stay-set variable.
func ReadVariable ¶
func ReadVariable(id string) (*StaySetVariable, error)
ReadVariable returns the stay-set variable for an id.
func (StaySetVariable) String ¶
func (ssv StaySetVariable) String() string
String implements the Stringer interface.
type StaySetVariables ¶
type StaySetVariables []*StaySetVariable
StaySetVariables is a set of stay-set variables.
func (StaySetVariables) Len ¶
func (s StaySetVariables) Len() int
func (StaySetVariables) Less ¶
func (s StaySetVariables) Less(i, j int) bool
func (StaySetVariables) Swap ¶
func (s StaySetVariables) Swap(i, j int)