metrictest

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package metrictest provides helpers for metric testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dimension

type Dimension map[KV]int64

Dimension defines a generic dimension.

type Int64Metrics

type Int64Metrics map[Key]Dimension

Int64Metrics defines a metric to dimension mapping for int64 metrics.

func GatherInt64Metric

func GatherInt64Metric(ms []metricdata.Metrics) Int64Metrics

GatherInt64Metric gathers the observed int64 metrics grouped by dimension.

type KV

type KV struct{ K, V string }

KV holds the key and value for a dimension

type Key

type Key struct{ Name, Unit string }

Key holds the key for the metric name and unit.

type TestMetric

type TestMetric struct {
	Reader        sdkmetric.Reader
	MeterProvider *sdkmetric.MeterProvider
	Meter         metric.Meter
}

TestMetric returns all the necessary for tests.

func New

func New() (tm TestMetric)

New creates a manual reader, meter provider and a meter from it.

func (TestMetric) Collect

func (tm TestMetric) Collect(ctx context.Context) (
	rm metricdata.ResourceMetrics, err error,
)

Collect returns the metrics from the reader.

Jump to

Keyboard shortcuts

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