Documentation ¶
Overview ¶
Package metrics provides unified way of emitting metrics inside Kopia.
Index ¶
- Variables
- type Counter
- type Distribution
- type DistributionState
- type Registry
- func (r *Registry) Close(ctx context.Context) error
- func (r *Registry) CounterInt64(name, help string, labels map[string]string) *Counter
- func (r *Registry) DurationDistribution(name, help string, thresholds *Thresholds[time.Duration], ...) *Distribution[time.Duration]
- func (r *Registry) Log(ctx context.Context)
- func (r *Registry) SizeDistribution(name, help string, thresholds *Thresholds[int64], labels map[string]string) *Distribution[int64]
- func (r *Registry) Snapshot(reset bool) Snapshot
- func (r *Registry) Throughput(name, help string, labels map[string]string) *Throughput
- type Snapshot
- type Thresholds
- type Throughput
Constants ¶
This section is empty.
Variables ¶
var CPULatencyThresholds = &Thresholds[time.Duration]{ []time.Duration{ 10 * time.Microsecond, 25 * time.Microsecond, 50 * time.Microsecond, 100 * time.Microsecond, 250 * time.Microsecond, 500 * time.Microsecond, 1000 * time.Microsecond, 2500 * time.Microsecond, 5000 * time.Microsecond, 10 * time.Millisecond, 25 * time.Millisecond, 50 * time.Millisecond, 100 * time.Millisecond, 250 * time.Millisecond, 500 * time.Millisecond, 1000 * time.Millisecond, 2500 * time.Millisecond, 5000 * time.Millisecond, }, 1, "_ns", }
CPULatencyThresholds is a set of thresholds that can represent CPU latencies from 10us to 5s.
var IOLatencyThresholds = &Thresholds[time.Duration]{ []time.Duration{ 500 * time.Microsecond, 1000 * time.Microsecond, 2500 * time.Microsecond, 5000 * time.Microsecond, 10 * time.Millisecond, 25 * time.Millisecond, 50 * time.Millisecond, 100 * time.Millisecond, 250 * time.Millisecond, 500 * time.Millisecond, 1000 * time.Millisecond, 2500 * time.Millisecond, 5000 * time.Millisecond, 10 * time.Second, 25 * time.Second, 50 * time.Second, }, 1e6, "_ms", }
IOLatencyThresholds is a set of thresholds that can represent IO latencies from 500us to 50s.
var ISOBytesThresholds = &Thresholds[int64]{ []int64{ 100, 250, 500, 1_000, 2_500, 5_000, 10_000, 25_000, 50_000, 100_000, 250_000, 500_000, 1_000_000, 2_500_000, 5_000_000, 10_000_000, 25_000_000, 50_000_000, 100_000_000, 250_000_000, 500_000_000, }, 1, "", }
ISOBytesThresholds is a set of thresholds for sizes.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter represents a monotonically increasing int64 counter value.
type Distribution ¶
type Distribution[T constraints.Integer | constraints.Float] struct { // contains filtered or unexported fields }
Distribution measures distribution/summary of values.
func (*Distribution[T]) Observe ¶
func (d *Distribution[T]) Observe(value T)
Observe adds the provided observation value to the summary.
func (*Distribution[T]) Snapshot ¶
func (d *Distribution[T]) Snapshot(reset bool) *DistributionState[T]
Snapshot returns a snapshot of the distribution state.
type DistributionState ¶
type DistributionState[T constraints.Float | constraints.Integer] struct { Min T `json:"min"` Max T `json:"max"` Sum T `json:"sum"` Count int64 `json:"count"` BucketCounters []int64 `json:"buckets"` BucketThresholds []T `json:"-"` }
DistributionState captures momentary state of a Distribution.
func (*DistributionState[T]) Mean ¶
func (s *DistributionState[T]) Mean() T
Mean returns arithmetic mean value captured in the distribution.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry groups together all metrics stored in the repository and provides ways of accessing them.
func (*Registry) CounterInt64 ¶
CounterInt64 gets a persistent int64 counter with the provided name.
func (*Registry) DurationDistribution ¶
func (r *Registry) DurationDistribution(name, help string, thresholds *Thresholds[time.Duration], labels map[string]string) *Distribution[time.Duration]
DurationDistribution gets a persistent duration distribution with the provided name.
func (*Registry) SizeDistribution ¶
func (r *Registry) SizeDistribution(name, help string, thresholds *Thresholds[int64], labels map[string]string) *Distribution[int64]
SizeDistribution gets a persistent size distribution with the provided name.
func (*Registry) Throughput ¶
func (r *Registry) Throughput(name, help string, labels map[string]string) *Throughput
Throughput gets a persistent counter with the provided name.
type Snapshot ¶
type Snapshot struct { Counters map[string]int64 `json:"counters"` DurationDistributions map[string]*DistributionState[time.Duration] `json:"durationDistributions"` SizeDistributions map[string]*DistributionState[int64] `json:"sizeDistributions"` }
Snapshot captures the state of all metrics.
func AggregateSnapshots ¶
AggregateSnapshots computes aggregate of the provided snapshots.
type Thresholds ¶
type Thresholds[T constraints.Float | constraints.Integer] struct { // contains filtered or unexported fields }
Thresholds encapsulates a set of bucket thresholds used in Summary[T].
type Throughput ¶
type Throughput struct {
// contains filtered or unexported fields
}
Throughput measures throughput by keeping track of total value and total duration.