promtest

package
v16.1.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockCounter

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

func (*MockCounter) Add

func (m *MockCounter) Add(v float64)

func (*MockCounter) Inc

func (m *MockCounter) Inc()

func (*MockCounter) Value

func (m *MockCounter) Value() float64

type MockGauge

type MockGauge struct {
	Value float64
	// contains filtered or unexported fields
}

MockGauge is a mock gauge that adheres to prometheus.Gauge for use in unit tests

func (*MockGauge) Dec

func (m *MockGauge) Dec()

Dec decrements the gauge value

func (*MockGauge) DecsCalled

func (m *MockGauge) DecsCalled() int

DecsCalled gives the number of times Inc() was been called

func (*MockGauge) Inc

func (m *MockGauge) Inc()

Inc increments the gauge value

func (*MockGauge) IncsCalled

func (m *MockGauge) IncsCalled() int

IncsCalled gives the number of times Inc() was been called

type MockHistogram

type MockHistogram struct {
	Values []float64
	// contains filtered or unexported fields
}

MockHistogram is a mock histogram that adheres to prometheus.Histogram for use in unit tests

func (*MockHistogram) Observe

func (m *MockHistogram) Observe(v float64)

Observe observes a value for the mock histogram

type MockHistogramVec

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

MockHistogramVec implements a subset of the prometheus.HistogramVec interface.

func NewMockHistogramVec

func NewMockHistogramVec() *MockHistogramVec

NewMockHistogramVec returns a new MockHistogramVec.

func (*MockHistogramVec) Collect

func (m *MockHistogramVec) Collect(chan<- prometheus.Metric)

Collect does nothing.

func (*MockHistogramVec) Describe

func (m *MockHistogramVec) Describe(chan<- *prometheus.Desc)

Describe does nothing.

func (*MockHistogramVec) LabelsCalled

func (m *MockHistogramVec) LabelsCalled() [][]string

LabelsCalled returns the set of labels which have been observed.

func (*MockHistogramVec) Observer

func (m *MockHistogramVec) Observer() *MockObserver

Observer returns the mocked observer.

func (*MockHistogramVec) WithLabelValues

func (m *MockHistogramVec) WithLabelValues(lvs ...string) prometheus.Observer

WithLabelValues records the given labels such that `LabelsCalled()` will return the set of observed labels.

type MockObserver

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

MockObserver implements a subset of the prometheus.Observer interface.

func (*MockObserver) Observe

func (m *MockObserver) Observe(v float64)

Observe records the given value in its observed values.

func (*MockObserver) Observed

func (m *MockObserver) Observed() []float64

Observed returns all observed values.

type MockStorageGauge

type MockStorageGauge struct {
	*MockGauge
}

MockStorageGauge wraps a MockGauge

func (*MockStorageGauge) Dec

func (m *MockStorageGauge) Dec(_, _ string)

Dec will track total calls to this method while ignoring params

func (*MockStorageGauge) Inc

func (m *MockStorageGauge) Inc(_, _ string)

Inc will track total calls to this method while ignoring params

Jump to

Keyboard shortcuts

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