export

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Descriptor

type Descriptor struct {
	// contains filtered or unexported fields
}

Descriptor describes a metric instrument to the exporter.

func NewDescriptor

func NewDescriptor(
	name string,
	metricKind MetricKind,
	keys []core.Key,
	description string,
	unit unit.Unit,
	numberKind core.NumberKind,
	alternate bool,
) *Descriptor

NewDescriptor builds a new descriptor, for use by `Meter` implementations.

func (*Descriptor) Alternate

func (d *Descriptor) Alternate() bool

func (*Descriptor) Description

func (d *Descriptor) Description() string

func (*Descriptor) Keys

func (d *Descriptor) Keys() []core.Key

func (*Descriptor) MetricKind

func (d *Descriptor) MetricKind() MetricKind

func (*Descriptor) Name

func (d *Descriptor) Name() string

func (*Descriptor) NumberKind

func (d *Descriptor) NumberKind() core.NumberKind

func (*Descriptor) Unit

func (d *Descriptor) Unit() unit.Unit

type Event

type Event struct {
	// Message describes the Event.
	Message string

	// Attributes contains a list of keyvalue pairs.
	Attributes []core.KeyValue

	// Time is the time at which this event was recorded.
	Time time.Time
}

Event is used to describe an Event with a message string and set of Attributes.

type MetricAggregator

type MetricAggregator interface {
	// Update receives a new measured value and incorporates it
	// into the aggregation.
	Update(context.Context, core.Number, MetricRecord)

	// Collect is called during the SDK Collect() to
	// finish one period of aggregation.  Collect() is
	// called in a single-threaded context.  Update()
	// calls may arrive concurrently.
	Collect(context.Context, MetricRecord, MetricBatcher)

	// Merge combines state from two aggregators into one.
	Merge(MetricAggregator, *Descriptor)
}

MetricAggregator implements a specific aggregation behavior, e.g., a counter, a gauge, a histogram.

type MetricBatcher

type MetricBatcher interface {
	// AggregatorFor should return the kind of aggregator
	// suited to the requested export.  Returning `nil`
	// indicates to ignore the metric update.
	//
	// Note: This is context-free because the handle should not be
	// bound to the incoming context.  This call should not block.
	AggregatorFor(MetricRecord) MetricAggregator

	// Export receives pairs of records and aggregators
	// during the SDK Collect().  Exporter implementations
	// must access the specific aggregator to receive the
	// exporter data, since the format of the data varies
	// by aggregation.
	Export(context.Context, MetricRecord, MetricAggregator)
}

MetricBatcher is responsible for deciding which kind of aggregation to use and gathering exported results from the SDK. The standard SDK supports binding only one of these interfaces, i.e., a single exporter.

Multiple-exporters could be implemented by implementing this interface for a group of MetricBatcher.

type MetricKind

type MetricKind int8

MetricKind describes the kind of instrument.

const (
	CounterMetricKind MetricKind = iota
	GaugeMetricKind
	MeasureMetricKind
)

type MetricRecord

type MetricRecord interface {
	// Descriptor() describes the metric instrument.
	Descriptor() *Descriptor

	// Labels() describe the labsels corresponding the
	// aggregation being performed.
	Labels() []core.KeyValue
}

MetricRecord is the unit of export, pairing a metric instrument and set of labels.

type SpanBatcher

type SpanBatcher interface {
	ExportSpans(context.Context, []*SpanData)
}

SpanBatcher is a type for functions that receive batched of sampled trace spans.

The ExportSpans method is called asynchronously. However its should not take forever to process the spans.

The SpanData should not be modified.

type SpanData

type SpanData struct {
	SpanContext  core.SpanContext
	ParentSpanID core.SpanID
	SpanKind     apitrace.SpanKind
	Name         string
	StartTime    time.Time
	// The wall clock time of EndTime will be adjusted to always be offset
	// from StartTime by the duration of the span.
	EndTime                  time.Time
	Attributes               []core.KeyValue
	MessageEvents            []Event
	Links                    []apitrace.Link
	Status                   codes.Code
	HasRemoteParent          bool
	DroppedAttributeCount    int
	DroppedMessageEventCount int
	DroppedLinkCount         int

	// ChildSpanCount holds the number of child span created for this span.
	ChildSpanCount int
}

SpanData contains all the information collected by a span.

type SpanSyncer

type SpanSyncer interface {
	ExportSpan(context.Context, *SpanData)
}

SpanSyncer is a type for functions that receive a single sampled trace span.

The ExportSpan method is called synchronously. Therefore, it should not take forever to process the span.

The SpanData should not be modified.

Directories

Path Synopsis
metric module

Jump to

Keyboard shortcuts

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