cases

package
v0.0.0-...-01fc169 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Appendable

type Appendable struct {
	sync.Mutex
	Batches []Batch
}

func (*Appendable) Appender

func (m *Appendable) Appender(_ context.Context) storage.Appender

type Batch

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

func (*Batch) Append

func (*Batch) AppendCTZeroSample

func (*Batch) AppendCTZeroSample(_ storage.SeriesRef, l labels.Labels, t, ct int64) (storage.SeriesRef, error)

func (*Batch) AppendExemplar

func (*Batch) Commit

func (m *Batch) Commit() error

func (*Batch) Rollback

func (*Batch) Rollback() error

func (*Batch) UpdateMetadata

type Test

type Test struct {
	Name     string
	Metrics  http.Handler
	Expected Validator

	// Optional "middleware" to intercept the write requests.
	Writes func(http.Handler) http.Handler
}

func CounterTest

func CounterTest() Test

CounterTest exports a single metric - a counter - and checks that we receive that metric via remote write, and that it has the correct value.

func EmptyLabelsTest

func EmptyLabelsTest() Test

EmptyLabelsTests exports a single, constant metric with an empty labels and checks that we receive the metrics without said label.

func GaugeTest

func GaugeTest() Test

GaugeTest exports a single metric - the current time - and checks that we receive that metric via remote write, and that it has the correct value.

func HeadersTest

func HeadersTest() Test

HeadersTest exports a single metric - a gauge - and checks that we receive the right headers on remote write requests.

func HistogramTest

func HistogramTest() Test

HistogramTest exports a histogram and checks that we receive metrics for it, and that it has the correct value.

func HonorLabelsTest

func HonorLabelsTest() Test

HonorLabels exports a single, constant metric with a job label and checks that we receive metrics a exported_job label.

func InstanceLabelTest

func InstanceLabelTest() Test

InstanceLabel exports a single metric - the current time - and checks that we receive that metric via remote write, and that it has a instance label that we expect.

func InvalidTest

func InvalidTest() Test

InvalidTest exports invalid Prometheus metrics and checks we receive an up == 0 metric for that job.

func JobLabelTest

func JobLabelTest() Test

JobLabel exports a single metric - the current time - and checks that we receive that metric via remote write, and that it has a job label.

func NameLabelTest

func NameLabelTest() Test

NameLabelTests exports a single, constant metric with no name label and checks that we don't receive metrics without a name label - the scape should fail.

func OrderingTest

func OrderingTest() Test

OrderingTest exports a lot of metrics, and inserts random delays in the push handler to see if we can force agents to send us metrics in the wrong order.

func RepeatedLabelsTest

func RepeatedLabelsTest() Test

RepeatedLabelsTest exports a single, constant metric with repeated labels and checks that we don't receive metrics any metrics - the scrape should fail.

func Retries400Test

func Retries400Test() Test

Retries400Test rejects the first remote write and checks it doesn't get resent.

func Retries500Test

func Retries500Test() Test

Retries500Test rejects the first remote write and checks it gets resent.

func SortedLabelsTest

func SortedLabelsTest() Test

SortedLabelsTest exports a single, constant metric with labels in the wrong order and checks that we receive the metrics with sorted labels.

func StalenessTest

func StalenessTest() Test

StalenessTest exposes a single metric that is then removed before the next scrape and checks that the sender propagates a staleness marker.

func SummaryTest

func SummaryTest() Test

SummaryTest exports a single metric - a summary - and checks that we receive that metric via remote write, and that it has the correct value.

func TimestampTest

func TimestampTest() Test

TimestampTest exports a single, constant metric and checks that we receive that metric with "reasonable" timestamps.

func UpTest

func UpTest() Test

UpTest exports a single, constant metric and checks that we receive up metrics for that target, and that it has the correct value.

type Validator

type Validator func(t *testing.T, bs []Batch)

Jump to

Keyboard shortcuts

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