package test

import "go.opentelemetry.io/otel/sdk/metric/batcher/test"

Index

Variables

var (
	// GaugeDesc groups by "G"
	GaugeDesc = export.NewDescriptor(
		"gauge", export.GaugeKind, []core.Key{key.New("G")}, "", "", core.Int64NumberKind, false)
	// CounterDesc groups by "C"
	CounterDesc = export.NewDescriptor(
		"counter", export.CounterKind, []core.Key{key.New("C")}, "", "", core.Int64NumberKind, false)

	// SdkEncoder uses a non-standard encoder like K1~V1&K2~V2
	SdkEncoder = &Encoder{}
	// GroupEncoder uses the SDK default encoder
	GroupEncoder = sdk.DefaultLabelEncoder()

	// Labels1 has G=H and C=D
	Labels1 = makeLabels(SdkEncoder, key.String("G", "H"), key.String("C", "D"))
	// Labels2 has C=D and E=F
	Labels2 = makeLabels(SdkEncoder, key.String("C", "D"), key.String("E", "F"))
	// Labels3 is the empty set
	Labels3 = makeLabels(SdkEncoder)
)

Functions

func CounterAgg

func CounterAgg(v int64) export.Aggregator

CounterAgg returns a checkpointed counter aggregator w/ the specified value.

func GaugeAgg

func GaugeAgg(v int64) export.Aggregator

GaugeAgg returns a checkpointed gauge aggregator w/ the specified value.

func NewAggregationSelector

func NewAggregationSelector() export.AggregationSelector

NewAggregationSelector returns a policy that is consistent with the test descriptors above. I.e., it returns counter.New() for counter instruments and gauge.New for gauge instruments.

Types

type Encoder

type Encoder struct{}

Encoder is an alternate label encoder to validate grouping logic.

func (Encoder) Encode

func (Encoder) Encode(labels []core.KeyValue) string

type Output

type Output map[string]int64

Output collects distinct metric/label set outputs.

func (Output) AddTo

func (o Output) AddTo(rec export.Record)

AddTo adds a name/label-encoding entry with the gauge or counter value to the output map.

Source Files

test.go

Version
v0.1.1
Published
Nov 15, 2019
Platform
linux/amd64
Imports
9 packages
Last checked
7 minutes ago

Tools for package owners.