metrics

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2023 License: MPL-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicCollector

type AtomicCollector struct {
	// contains filtered or unexported fields
}

AtomicCollector is a simple Collector that atomically stores counters and gauges in memory.

func NewAtomicCollector

func NewAtomicCollector(defs Definitions) *AtomicCollector

NewAtomicCollector creates a collector for the given set of Definitions.

func (*AtomicCollector) IncrementCounter

func (c *AtomicCollector) IncrementCounter(name string, delta uint64)

IncrementCounter record val occurrences of the named event. Names will follow prometheus conventions with lower_case_and_underscores. We don't need any additional labels currently.

func (*AtomicCollector) SetGauge

func (c *AtomicCollector) SetGauge(name string, val uint64)

SetGauge sets the value of the named gauge overriding any previous value.

func (*AtomicCollector) Summary

func (c *AtomicCollector) Summary() Summary

Summary returns a summary of the metrics since startup. Each value is atomically loaded but the set is not atomic overall and may represent an inconsistent snapshot e.g. with some metrics reflecting the most recent operation while others don't.

type Collector

type Collector interface {
	// IncrementCounter record val occurrences of the named event. Names will
	// follow prometheus conventions with lower_case_and_underscores. We don't
	// need any additional labels currently.
	IncrementCounter(name string, delta uint64)

	// SetGauge sets the value of the named gauge overriding any previous value.
	SetGauge(name string, val uint64)
}

Collector provides a simple abstraction for counter type metrics that the WAL and log verifier can use without depending on a specific metrics collector implementation.

type Definitions

type Definitions struct {
	Counters []Descriptor
	Gauges   []Descriptor
}

Definitions provides a simple description of a set of scalar metrics.

type Descriptor

type Descriptor struct {
	Name string
	Desc string
}

Descriptor describes a specific metric.

type GoMetricsCollector

type GoMetricsCollector struct {
	// contains filtered or unexported fields
}

GoMetricsCollector implements a Collector that passes through observations to a go-metrics instance. The zero value works, writing metrics to the default global instance however to set a prefix or a static set of labels to add to each metric observed, or to use a non-global metrics instance use NewGoMetricsCollector.

func NewGoMetricsCollector

func NewGoMetricsCollector(prefix []string, labels []gometrics.Label, gm *gometrics.Metrics) *GoMetricsCollector

NewGoMetricsCollector returns a GoMetricsCollector that will attach the specified name prefix and/or labels to each observation. If gm is nil the global metrics instance is used.

func (*GoMetricsCollector) IncrementCounter

func (c *GoMetricsCollector) IncrementCounter(name string, delta uint64)

IncrementCounter record val occurrences of the named event. Names will follow prometheus conventions with lower_case_and_underscores. We don't need any additional labels currently.

func (*GoMetricsCollector) SetGauge

func (c *GoMetricsCollector) SetGauge(name string, val uint64)

SetGauge sets the value of the named gauge overriding any previous value.

type NoOpCollector

type NoOpCollector struct{}

NoOpCollector is a Collector that does nothing.

func (*NoOpCollector) IncrementCounter

func (c *NoOpCollector) IncrementCounter(name string, delta uint64)

IncrementCounter record val occurrences of the named event. Names will follow prometheus conventions with lower_case_and_underscores. We don't need any additional labels currently.

func (*NoOpCollector) SetGauge

func (c *NoOpCollector) SetGauge(name string, val uint64)

SetGauge sets the value of the named gauge overriding any previous value.

type Summary

type Summary struct {
	Counters map[string]uint64
	Gauges   map[string]uint64
}

Summary is a copy of the values recorded so far for each metric.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL