Documentation ¶
Overview ¶
Package metrics implements metrics collection and reporting.
Index ¶
- func NewWatchableComponent(c components.Component) components.WatchableComponent
- func ReadGetFailedTotal(gatherer prometheus.Gatherer) (int64, error)
- func ReadGetSuccessTotal(gatherer prometheus.Gatherer) (int64, error)
- func ReadHealthyTotal(gatherer prometheus.Gatherer) (int64, error)
- func ReadRegisteredTotal(gatherer prometheus.Gatherer) (int64, error)
- func ReadUnhealthyTotal(gatherer prometheus.Gatherer) (int64, error)
- func Register(reg *prometheus.Registry) error
- func SetGetFailed(componentName string)
- func SetGetSuccess(componentName string)
- func SetHealthy(componentName string)
- func SetRegistered(componentName string)
- func SetUnhealthy(componentName string)
- type Averager
- type Op
- type OpOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWatchableComponent ¶
func NewWatchableComponent(c components.Component) components.WatchableComponent
func ReadGetFailedTotal ¶
func ReadGetFailedTotal(gatherer prometheus.Gatherer) (int64, error)
func ReadGetSuccessTotal ¶
func ReadGetSuccessTotal(gatherer prometheus.Gatherer) (int64, error)
func ReadHealthyTotal ¶
func ReadHealthyTotal(gatherer prometheus.Gatherer) (int64, error)
func ReadRegisteredTotal ¶
func ReadRegisteredTotal(gatherer prometheus.Gatherer) (int64, error)
func ReadUnhealthyTotal ¶
func ReadUnhealthyTotal(gatherer prometheus.Gatherer) (int64, error)
func Register ¶
func Register(reg *prometheus.Registry) error
func SetGetFailed ¶
func SetGetFailed(componentName string)
func SetGetSuccess ¶
func SetGetSuccess(componentName string)
func SetHealthy ¶
func SetHealthy(componentName string)
func SetRegistered ¶
func SetRegistered(componentName string)
func SetUnhealthy ¶
func SetUnhealthy(componentName string)
Types ¶
type Averager ¶
type Averager interface { // Returns the ID. MetricName() string // Returns the last value and whether it exists. Last(ctx context.Context, opts ...OpOption) (float64, bool, error) // Observe the value at the given time and returns the current average. // If currentTime is zero, it uses the current system time in UTC. Observe(ctx context.Context, value float64, opts ...OpOption) error // Avg returns the average value from the "since" time. // If since is zero, returns the average value for all data points. Avg(ctx context.Context, opts ...OpOption) (float64, error) // EMA returns the EMA value from the "since" time. // If since is zero, returns the EMA value for all data points. // If the ema period is zero, returns the 1-minute EMA value. EMA(ctx context.Context, opts ...OpOption) (float64, error) // Returns all the data points since the given time. // If since is zero, returns all metrics. Read(ctx context.Context, opts ...OpOption) (state.Metrics, error) }
Defines the continuous averager interface.
func NewNoOpAverager ¶
func NewNoOpAverager() Averager
type OpOption ¶
type OpOption func(*Op)
func WithCurrentTime ¶
func WithEMAPeriod ¶
func WithMetricSecondaryName ¶
Click to show internal directories.
Click to hide internal directories.