Documentation ¶
Index ¶
Constants ¶
const ( NamesReconcile metricName = "reconcile" NamesDeployment metricName = "deployment" NamesDeploymentUpdateError metricName = "deploymentUpdateErrorCounter" NamesDeploymentDeleteCounter metricName = "deploymentDeleteCounter" NamesDeploymentDeleteError metricName = "deploymentDeleteErrorCounter" NamesDeploymentUpdateCounter metricName = "deploymentUpdateCounter" NamesConfigMap metricName = "configMap" NamesServicesCreated metricName = "servicesCreated" NamesServices metricName = "services" NamesRoleBindings metricName = "roleBindings" NamesIngress metricName = "ingress" NamesIngressDeleted metricName = "ingressDeleted" NamesVMOUpdate metricName = "vmoupdate" NamesQueue metricName = "queue" )
Variables ¶
var ( MetricsExp = metricsExporter{} DefaultLabelFunction func(index int64) string VMOUpdateLabelFunction func() string TestDelegate = metricsDelegate{} )
Functions ¶
func RegisterMetrics ¶
func RegisterMetrics()
RegisterMetrics begins the registration process, Required Initialization must be called first. This function does not start the metrics server
func RequiredInitialization ¶
func RequiredInitialization()
RequiredInitialization populates the metricsexporter, this function must be called before any other non-init exporter function is called
func StartMetricsServer ¶
func StartMetricsServer()
Types ¶
type CounterMetric ¶
type CounterMetric struct {
// contains filtered or unexported fields
}
Type to count events such as the number fo function calls.
func GetCounterMetrics ¶
func GetCounterMetrics(name metricName) (*CounterMetric, error)
GetCounterMetrics returns a simpleCounterMetric for use if it exists, otherwise returns nil.
func (*CounterMetric) Add ¶
func (c *CounterMetric) Add(num float64)
Add increases the counter metric by the argument value
func (*CounterMetric) GetLabel ¶
func (c *CounterMetric) GetLabel() string
GetLabel returns the current value of the counter as a string
type DurationMetric ¶
type DurationMetric struct {
// contains filtered or unexported fields
}
Type to track length of a function call. Method to start and stop the duration timer are available.
func GetDurationMetrics ¶
func GetDurationMetrics(name metricName) (*DurationMetric, error)
GetDurationMetrics returns a durationMetric for use if it exists, otherwise returns nil.
func (*DurationMetric) TimerStart ¶
func (d *DurationMetric) TimerStart()
Creates a new timer, and starts the timer
func (*DurationMetric) TimerStop ¶
func (d *DurationMetric) TimerStop()
stops the timer and record the duration since the last call to TimerStart
type ErrorMetric ¶
type ErrorMetric struct {
// contains filtered or unexported fields
}
Type to track the occurrence of an error. Includes a metod to add an error count
func GetErrorMetrics ¶
func GetErrorMetrics(name metricName) (*ErrorMetric, error)
GetErrorMetrics returns a ErrorMetric for use if it exists, otherwise returns nil.
func (*ErrorMetric) Inc ¶
func (e *ErrorMetric) Inc()
func (*ErrorMetric) IncWithLabel ¶
func (e *ErrorMetric) IncWithLabel(label string)
Adds an error count. The label must be supplied as an argument
type FunctionMetrics ¶
type FunctionMetrics struct {
// contains filtered or unexported fields
}
Class of metrics to automatically capture 4 types of metrics for a given function
func GetFunctionMetrics ¶
func GetFunctionMetrics(name metricName) (*FunctionMetrics, error)
GetFunctionMetrics returns a functionMetric for use if it exists, otherwise returns nil.
func (*FunctionMetrics) GetLabel ¶
func (f *FunctionMetrics) GetLabel() string
Invokes the supplied labelFunction to return the string which would be used as a label. The label can be dynamic and may change depending on the labelFunctions behavior (i.e. a timestamp string)
func (*FunctionMetrics) IncError ¶
func (f *FunctionMetrics) IncError()
func (*FunctionMetrics) LogEnd ¶
func (f *FunctionMetrics) LogEnd(errorObserved bool)
Method to defer to the end of the tracked function. Stops the duration timer, sets the lastCallTimestamp. Pass in an argument of true to set an error for the current function call.
func (*FunctionMetrics) LogStart ¶
func (f *FunctionMetrics) LogStart()
Method to call at the start of the tracked function. Starts the duration timer and increments the total count
type GaugeMetric ¶
type GaugeMetric struct {
// contains filtered or unexported fields
}
func GetGaugeMetrics ¶
func GetGaugeMetrics(name metricName) (*GaugeMetric, error)
GetGaugeMetrics returns a simpleGaugeMetric for use if it exists, otherwise returns nil.
func (*GaugeMetric) Add ¶
func (g *GaugeMetric) Add(num float64)
Add sets the value of the gauge metric to the current value plus the given value
func (*GaugeMetric) Set ¶
func (g *GaugeMetric) Set(num float64)
Set sets the value of the gauge metric to the given value
func (*GaugeMetric) SetToCurrentTime ¶
func (g *GaugeMetric) SetToCurrentTime()
SetToCurrentTime sets the value of the gauge metric to the system timestamp
type TimestampMetric ¶
type TimestampMetric struct {
// contains filtered or unexported fields
}
Type to track the last timestamp of a function call. Includes a method to set the last timestamp
func GetTimestampMetrics ¶
func GetTimestampMetrics(name metricName) (*TimestampMetric, error)
GetTimestampMetrics returns a timeStampMetric for use if it exists, otherwise returns nil.
func (*TimestampMetric) SetLastTime ¶
func (t *TimestampMetric) SetLastTime()
Adds a timestamp as the current time. The label must be supplied as an argument
func (*TimestampMetric) SetLastTimeWithLabel ¶
func (t *TimestampMetric) SetLastTimeWithLabel(indexString string)
Adds a timestamp as the current time. The label must be supplied as an argument