test

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LastValueADesc and LastValueBDesc group by "G"
	LastValueADesc = metric.NewDescriptor(
		"lastvalue.a", metric.ObserverKind, core.Int64NumberKind)
	LastValueBDesc = metric.NewDescriptor(
		"lastvalue.b", metric.ObserverKind, core.Int64NumberKind)
	// CounterADesc and CounterBDesc group by "C"
	CounterADesc = metric.NewDescriptor(
		"sum.a", metric.CounterKind, core.Int64NumberKind)
	CounterBDesc = metric.NewDescriptor(
		"sum.b", metric.CounterKind, core.Int64NumberKind)

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

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

Functions

func CounterAgg

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

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

func LastValueAgg added in v0.3.0

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

LastValueAgg returns a checkpointed lastValue 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 sum.New() for counter instruments and lastvalue.New for lastValue instruments.

func NewCounterRecord added in v0.2.0

func NewCounterRecord(desc *metric.Descriptor, labels *label.Set, value int64) export.Record

Convenience method for building a test exported counter record.

func NewLastValueRecord added in v0.3.0

func NewLastValueRecord(desc *metric.Descriptor, labels *label.Set, value int64) export.Record

Convenience method for building a test exported lastValue record.

Types

type Encoder

type Encoder struct{}

Encoder is an alternate label encoder to validate grouping logic.

func (Encoder) Encode

func (Encoder) Encode(iter label.Iterator) string

func (Encoder) ID added in v0.4.0

func (Encoder) ID() label.EncoderID

type Output

type Output struct {
	Map map[string]float64
	// contains filtered or unexported fields
}

Output collects distinct metric/label set outputs.

func NewOutput added in v0.4.0

func NewOutput(labelEncoder label.Encoder) Output

func (Output) AddTo

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

AddTo adds a name/label-encoding entry with the lastValue 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