Documentation ¶
Index ¶
- Constants
- Variables
- func Count() uint
- func GetSettingValue(na, de string, se url.Values) (out string, def bool)
- func ParseBool(na, de string, se url.Values) (out bool, def bool, err error)
- func ParseDuration(na, de string, se url.Values) (out time.Duration, def bool, err error)
- func ParseFileMode(na, de string, se url.Values) (out os.FileMode, def bool, err error)
- func ParseInt(na, de string, se url.Values) (out int, def bool, err error)
- func ParseSettings(ur *url.URL) (set url.Values, err error)
- func ParseUint(na, de string, se url.Values) (out uint, def bool, err error)
- func RecordFloat(name string, value float64)
- func RecordInt(name string, value int)
- func RecordUint(name string, value uint)
- func Start(name string, service Service) (<-chan Message, error)
- func WatchFloat(name string, value func() float64)
- func WatchInt(name string, value func() int)
- func WatchRuntimeMemory(name string)
- func WatchSignals()
- func WatchUint(name string, value func() uint)
- type Message
- type MessageError
- type MessageType
- type Service
Constants ¶
const (
ChannelBufferSize = 5000
)
Variables ¶
var ( // DefaultWatchInterval is the default interval for which we will record // values in the Watch functions. DefaultWatchInterval = time.Minute * 1 )
var (
Messages chan<- Message
)
Functions ¶
func GetSettingValue ¶
GetSettingValue will get the value from the given settings. If the setting is not defined the function will return the given default value.
func ParseBool ¶
ParseBool will parse the boolean for the given settings name. When the setting is not defined we will use the given default.
func ParseDuration ¶
ParseDuration will parse the duration for the given settings name. When the setting is not defined we will use the given default.
func ParseFileMode ¶
ParseFileMode will parse the os.FileMode for the given settings name. When the setting is not defined we will use the given default.
func ParseInt ¶
ParseInt will parse the uint in base 10 for the given settings name. When the setting is not defined we will use the given default.
func ParseUint ¶
ParseUint will parse the uint in base 10 for the given settings name. When the setting is not defined we will use the given default.
func RecordFloat ¶
RecordFloat will take a metricname and a float value and record it to syslog.
func RecordUint ¶
RecordUint will take a metricname and a uint value and record it to syslog.
func Start ¶
Start will start a given service and return the message channel. This function can be run multible times and will always return the same message channel.
func WatchFloat ¶
WatchFloat will take a function that returns a float value and record the output of that function every DefaultWatchInterval.
func WatchInt ¶
WatchInt will take a function that returns a int value and record the output of that function every DefaultWatchInterval.
func WatchRuntimeMemory ¶
func WatchRuntimeMemory(name string)
WatchRuntimeMemory will record the runtime memory stats every DefaultWatchInterval.
func WatchSignals ¶
func WatchSignals()
WatchSignals waits for unix signals and handles them appropiatly. SIGINT/SIGTERM: Stop services and return. SIGHUP: Reload services. SIGQUIT: Dump core and return.
Types ¶
type Message ¶
type Message interface { Type() MessageType Source() string }
type MessageError ¶
type MessageError struct { Error error // contains filtered or unexported fields }
func (MessageError) Source ¶
func (me MessageError) Source() string
func (MessageError) Type ¶
func (me MessageError) Type() MessageType