metrics

package
v1.19.6 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GaugeDefinition

type GaugeDefinition struct {
	Name     string
	Labels   map[string]string
	Expected float64
}

type MetricsClient

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

func NewMetricsClient

func NewMetricsClient(httpClient client.HTTP, options ...Option) *MetricsClient

func (*MetricsClient) Fetch

func (c *MetricsClient) Fetch(ctx context.Context) (*Snapshot, error)

func (*MetricsClient) WaitForGauge

func (c *MetricsClient) WaitForGauge(ctx context.Context, definition GaugeDefinition, pollInterval time.Duration) error

func (*MetricsClient) WaitForSnapshot

func (c *MetricsClient) WaitForSnapshot(
	ctx context.Context,
	pollInterval time.Duration,
	check func(*Snapshot) error,
) (*Snapshot, error)

type Option

type Option func(*MetricsClient)

func WithFetchTimeout

func WithFetchTimeout(timeout time.Duration) Option

func WithWaitTimeout

func WithWaitTimeout(timeout time.Duration) Option

type Snapshot

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

func (*Snapshot) Gauge

func (s *Snapshot) Gauge(name string, labels map[string]string) (float64, error)

func (*Snapshot) GaugeSum

func (s *Snapshot) GaugeSum(name string, labels map[string]string) (float64, error)

func (*Snapshot) HistogramCount

func (s *Snapshot) HistogramCount(name string, labels map[string]string) (uint64, error)

func (*Snapshot) Payload

func (s *Snapshot) Payload() string

type SnapshotCheck

type SnapshotCheck func(*Snapshot) error

func GaugeAtLeast

func GaugeAtLeast(name string, labels map[string]string, minimum float64) SnapshotCheck

func GaugeEquals

func GaugeEquals(name string, labels map[string]string, expected float64) SnapshotCheck

func GaugeSumEquals

func GaugeSumEquals(name string, labels map[string]string, expected float64) SnapshotCheck

func HistogramCountAtLeast

func HistogramCountAtLeast(name string, labels map[string]string, minimum uint64) SnapshotCheck

Jump to

Keyboard shortcuts

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