monitoring

package
v0.0.0-...-fe39cb5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2015 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

The Tideland Go Library 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

View Source
const (
	ErrMonitorPanicked = iota + 1
	ErrMonitorCannotBeRecovered
	ErrMeasuringPointNotExists
	ErrStaySetVariableNotExists
	ErrDynamicStatusNotExists
)

Variables

This section is empty.

Functions

func DecrVariable

func DecrVariable(id string)

DecrVariable decreases a variable.

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 IncrVariable

func IncrVariable(id string)

IncrVariable increases a variable.

func IsDynamicStatusNotExistsError

func IsDynamicStatusNotExistsError(err error) bool

IsDynamicStatusNotExistsError returns true, if the error signals that a wanted dynamic status cannot be retrieved because it doesn't exists.

func IsMeasuringPointNotExistsError

func IsMeasuringPointNotExistsError(err error) bool

IsMeasuringPointNotExistsError returns true, if the error signals that a wanted measuring point cannot be retrieved because it doesn't exists.

func IsMonitorCannotBeRecoveredError

func IsMonitorCannotBeRecoveredError(err error) bool

IsMonitorCannotBeRecoveredError returns true, if the error signals that the monitor backend has panicked to often and cannot be recovered.

func IsMonitorPanickedError

func IsMonitorPanickedError(err error) bool

IsMonitorPanickedError returns true, if the error signals that the monitor backend panicked.

func IsStaySetVariableNotExistsError

func IsStaySetVariableNotExistsError(err error) bool

IsStaySetVariableNotExistsError returns true, if the error signals that a wanted stay-set variable cannot be retrieved because it doesn't exists.

func Measure

func Measure(id string, f func()) time.Duration

Measure the execution of a function.

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 PackageVersion

func PackageVersion() version.Version

PackageVersion returns the version of the version package.

func ReadStatus

func ReadStatus(id string) (string, error)

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 Reset

func Reset() error

Reset clears all monitored values.

func SetVariable

func SetVariable(id string, v int64)

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

type DynamicStatusRetriever func() (string, error)

DynamicStatusRetriever is called by the server and returns a current status as string.

type DynamicStatusValue

type DynamicStatusValue struct {
	Id    string
	Value string
}

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

func BeginMeasuring(id string) *Measuring

BeginMeasuring starts a new measuring with a given id. All measurings with the same id will be aggregated.

func (*Measuring) EndMeasuring

func (m *Measuring) EndMeasuring() time.Duration

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL