metricdatatest

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

SDK Metric data test

PkgGoDev

Documentation

Overview

Package metricdatatest provides testing functionality for use with the metricdata package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertAggregationsEqual

func AssertAggregationsEqual(t TestingT, expected, actual metricdata.Aggregation, opts ...Option) bool

AssertAggregationsEqual asserts that two Aggregations are equal.

func AssertEqual

func AssertEqual[T Datatypes](t TestingT, expected, actual T, opts ...Option) bool

AssertEqual asserts that the two concrete data-types from the metricdata package are equal.

func AssertHasAttributes added in v0.34.0

func AssertHasAttributes[T Datatypes](t TestingT, actual T, attrs ...attribute.KeyValue) bool

AssertHasAttributes asserts that all Datapoints or HistogramDataPoints have all passed attrs.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option allows for fine grain control over how AssertEqual operates.

func IgnoreExemplars added in v0.38.0

func IgnoreExemplars() Option

IgnoreExemplars disables checking if Exemplars are different.

func IgnoreTimestamp

func IgnoreTimestamp() Option

IgnoreTimestamp disables checking if timestamps are different.

func IgnoreValue added in v0.41.0

func IgnoreValue() Option

IgnoreValue disables checking if values are different. This can be useful for non-deterministic values, like measured durations.

This will ignore the value and trace information for Exemplars; the buckets, zero count, scale, sum, max, min, and counts of ExponentialHistogramDataPoints; the buckets, sum, count, max, and min of HistogramDataPoints; the value of DataPoints.

type TestingT added in v0.41.0

type TestingT interface {
	Helper()

	Error(...any)
}

TestingT is an interface that implements testing.T, but without the private method of testing.TB, so other testing packages can rely on it as well. The methods in this interface must match the testing.TB interface.

Jump to

Keyboard shortcuts

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