test

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GaugeADesc and GaugeBDesc group by "G"
	GaugeADesc = export.NewDescriptor(
		"gauge.a", export.GaugeKind, []core.Key{key.New("G")}, "", "", core.Int64NumberKind, false)
	GaugeBDesc = export.NewDescriptor(
		"gauge.b", export.GaugeKind, []core.Key{key.New("G")}, "", "", core.Int64NumberKind, false)
	// CounterADesc and CounterBDesc group by "C"
	CounterADesc = export.NewDescriptor(
		"counter.a", export.CounterKind, []core.Key{key.New("C")}, "", "", core.Int64NumberKind, false)
	CounterBDesc = export.NewDescriptor(
		"counter.b", 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.NewDefaultLabelEncoder()

	// 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(desc *export.Descriptor, v int64) export.Aggregator

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

func GaugeAgg

func GaugeAgg(desc *export.Descriptor, v int64) export.Aggregator

GaugeAgg returns a checkpointed gauge aggregator w/ the specified descriptor and 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.

func NewCounterRecord added in v0.2.0

func NewCounterRecord(desc *export.Descriptor, labels export.Labels, value int64) export.Record

Convenience method for building a test exported counter record.

func NewGaugeRecord added in v0.2.0

func NewGaugeRecord(desc *export.Descriptor, labels export.Labels, value int64) export.Record

Convenience method for building a test exported gauge record.

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.

Jump to

Keyboard shortcuts

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