testutil

package
v0.17.1-beta.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: Apache-2.0 Imports: 8 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MetricNameLabel is label under which model.Sample stores metric name
	MetricNameLabel model.LabelName = model.MetricNameLabel
	// QuantileLabel is label under which model.Sample stores latency quantile value
	QuantileLabel model.LabelName = model.QuantileLabel
)

Functions

func CollectAndCompare

func CollectAndCompare(c metrics.Collector, expected io.Reader, metricNames ...string) error

CollectAndCompare registers the provided Collector with a newly created pedantic Registry. It then does the same as GatherAndCompare, gathering the metrics from the pedantic Registry.

func ComputeHistogramDelta

func ComputeHistogramDelta(before, after model.Samples, label model.LabelName)

ComputeHistogramDelta computes the change in histogram metric for a selected label. Results are stored in after samples

func CustomCollectAndCompare

func CustomCollectAndCompare(c metrics.StableCollector, expected io.Reader, metricNames ...string) error

CustomCollectAndCompare registers the provided StableCollector with a newly created registry. It then does the same as GatherAndCompare, gathering the metrics from the pedantic Registry.

func ExtractMetricSamples

func ExtractMetricSamples(metricsBlob string) ([]*model.Sample, error)

ExtractMetricSamples parses the prometheus metric samples from the input string.

func GatherAndCompare

func GatherAndCompare(g metrics.Gatherer, expected io.Reader, metricNames ...string) error

GatherAndCompare gathers all metrics from the provided Gatherer and compares it to an expected output read from the provided Reader in the Prometheus text exposition format. If any metricNames are provided, only metrics with those names are compared.

func ParseMetrics

func ParseMetrics(data string, output *Metrics) error

ParseMetrics parses Metrics from data returned from prometheus endpoint

func PrintSample

func PrintSample(sample *model.Sample) string

PrintSample returns formated representation of metric Sample

Types

type Metrics

type Metrics map[string]model.Samples

Metrics is generic metrics for other specific metrics

func NewMetrics

func NewMetrics() Metrics

NewMetrics returns new metrics which are initialized.

func (*Metrics) Equal

func (m *Metrics) Equal(o Metrics) bool

Equal returns true if all metrics are the same as the arguments.

Jump to

Keyboard shortcuts

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