test

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Resource is applied to all test records built in this package.
	Resource = resource.New(kv.String("R", "V"))

	// LastValueADesc and LastValueBDesc group by "G"
	LastValueADesc = metric.NewDescriptor(
		"lastvalue.a", metric.ValueObserverKind, metric.Int64NumberKind)
	LastValueBDesc = metric.NewDescriptor(
		"lastvalue.b", metric.ValueObserverKind, metric.Int64NumberKind)
	// CounterADesc and CounterBDesc group by "C"
	CounterADesc = metric.NewDescriptor(
		"sum.a", metric.CounterKind, metric.Int64NumberKind)
	CounterBDesc = metric.NewDescriptor(
		"sum.b", metric.CounterKind, metric.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(kv.String("G", "H"), kv.String("C", "D"))
	// Labels2 has C=D and E=F
	Labels2 = makeLabels(kv.String("C", "D"), kv.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

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

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

Convenience method for building a test exported counter record.

func NewLastValueRecord

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

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

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