metrics

package
v1.19.5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 11 Imported by: 0

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