Documentation ¶
Index ¶
- type Snapshot
- func (s *Snapshot) AssertCount(name string, labels map[string]string, value float64)
- func (s *Snapshot) AssertGauge(name string, labels map[string]string, value float64)
- func (s *Snapshot) AssertHistogram(name string, labels map[string]string, sum float64, count uint64)
- func (s *Snapshot) AssertHistogramSampleCount(name string, sampleCount uint64)
- func (s *Snapshot) AssertSummary(name string, labels map[string]string, sum float64, count uint64)
- func (s *Snapshot) AssertSummaryNonZero(name string, labels map[string]string)
- func (s *Snapshot) GetMetric(metricType dto.MetricType, name string, labels map[string]string) *dto.Metric
- type TestRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Snapshot ¶
type Snapshot struct { MetricMap map[string]*dto.MetricFamily // contains filtered or unexported fields }
Snapshot provides methods for asserting on metrics
func (*Snapshot) AssertCount ¶
AssertCount asserts existence and count of a counter in the snapshot.
func (*Snapshot) AssertGauge ¶
AssertGauge asserts existence and value of a gauge in the snapshot.
func (*Snapshot) AssertHistogram ¶
func (s *Snapshot) AssertHistogram(name string, labels map[string]string, sum float64, count uint64)
AssertHistogram asserts that the existence and the sample sum and count of a histogram in the snapshot.
func (*Snapshot) AssertHistogramSampleCount ¶
AssertHistogramSampleCount asserts that the histogram exists and contains exact number of samples
func (*Snapshot) AssertSummary ¶
AssertSummary asserts that the existence and the sample sum and count of a summary in the snapshot.
func (*Snapshot) AssertSummaryNonZero ¶
AssertSummaryNonZero asserts that the summary exists and its value is non-zero
type TestRegistry ¶
type TestRegistry struct { *prometheus.Registry // contains filtered or unexported fields }
TestRegistry is a prometheus registry meant to be used for testing
func NewTestRegistry ¶
func NewTestRegistry(t *testing.T) *TestRegistry
NewTestRegistry allocates and initializes a new TestRegistry
func (*TestRegistry) TakeSnapshot ¶
func (r *TestRegistry) TakeSnapshot() (*Snapshot, error)
TakeSnapshot takes a snapshot of the current values of metrics for testing