Documentation ¶
Overview ¶
Package metrics contains modules that collect data or metrics from other modules.
The preferred way to collect metrics is to send an event from the target module onto the metrics event loop. The metrics event loop is a secondary event loop that is reserved for this purpose. It is available both for client modules and replica modules.
A ticker is used to determine how often metrics should be logged. To receive tick events, you can add an observer for a types.TickEvent on the metrics logger. When receiving the tick event, you should write the relevant data to the MetricsLogger module as a protobuf message.
Index ¶
- func GetClientMetrics(names ...string) (metrics []interface{})
- func GetReplicaMetrics(names ...string) (metrics []interface{})
- func RegisterClientMetric(name string, constructor func() interface{})
- func RegisterReplicaMetric(name string, constructor func() interface{})
- type ClientLatency
- type Throughput
- type Ticker
- type ViewTimeouts
- type Welford
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClientMetrics ¶
func GetClientMetrics(names ...string) (metrics []interface{})
GetClientMetrics constructs a new instance of each named metric.
func GetReplicaMetrics ¶
func GetReplicaMetrics(names ...string) (metrics []interface{})
GetReplicaMetrics constructs a new instance of each named metric.
func RegisterClientMetric ¶
func RegisterClientMetric(name string, constructor func() interface{})
RegisterClientMetric registers the constructor of a client metric.
func RegisterReplicaMetric ¶
func RegisterReplicaMetric(name string, constructor func() interface{})
RegisterReplicaMetric registers the constructor of a replica metric.
Types ¶
type ClientLatency ¶
type ClientLatency struct {
// contains filtered or unexported fields
}
ClientLatency processes LatencyMeasurementEvents, and writes LatencyMeasurements to the metrics logger.
func (*ClientLatency) InitModule ¶
func (lr *ClientLatency) InitModule(mods *modules.Modules)
InitModule gives the module access to the other modules.
type Throughput ¶
type Throughput struct {
// contains filtered or unexported fields
}
Throughput measures throughput in commits per second, and commands per second.
func (*Throughput) InitModule ¶
func (t *Throughput) InitModule(mods *modules.Modules)
InitModule gives the module access to the other modules.
type Ticker ¶
type Ticker struct {
// contains filtered or unexported fields
}
Ticker emits TickEvents on the data event loop.
func (*Ticker) InitModule ¶
InitModule gives the module access to the other modules.
type ViewTimeouts ¶
type ViewTimeouts struct {
// contains filtered or unexported fields
}
ViewTimeouts is a metric that measures the number of view timeouts that happen.
func (*ViewTimeouts) InitModule ¶
func (vt *ViewTimeouts) InitModule(mods *modules.Modules)
InitModule gives the module access to the other modules.
type Welford ¶
type Welford struct {
// contains filtered or unexported fields
}
Welford is an implementation of Welford's online algorithm for calculating variance.
func (*Welford) Count ¶
Count returns the total number of values that have been added to the variance estimate.