data

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReallocateFrom

func ReallocateFrom[T any](p *[]T) *T

ReallocateFrom returns the pointer to the next available slice location, allowing re-use by trying to extend the length of an existing slice up to its capacity before allocating new storage.

Types

type Collector

type Collector interface {
	// Collect gathers data points from processed accumulator
	// snapshots into output.
	Collect(sequence Sequence, output *[]Instrument)

	// InMemorySize returns the number of entries held in memory.  InMemorySize()
	// is meant to be called following Collect().
	InMemorySize() int
}

Collector is an interface for producing a single Instrument of data.

type Instrument

type Instrument struct {
	// Descriptor describes an instrument created through a View,
	// including name, unit, description, instrument and number kinds.
	Descriptor sdkinstrument.Descriptor

	// Points is a slice of metric data, one per attribute.Set value.
	Points []Point
}

Instrument is the result of a single collection for a single Instrument.

See the comments on Metrics about re-use of slices in this struct.

func (*Instrument) Reset

func (in *Instrument) Reset()

Reset sets the size of every slice to zero, while maintaining capacity, to support re-use.

type Metrics

type Metrics struct {
	// Resource is the MeterProvider's configured Resource.
	Resource *resource.Resource

	// Scopes is a slice of metric data, one per Meter.
	Scopes []Scope
}

Metrics is the result of a single collection.

This struct supports re-use of the nested memory structure in its Scopes slice such that repeated calls Produce will not reallocate the same quantity of memory again and again.

To re-use the memory from a previous Metrics value, pass a pointer to the former result to Produce(). This is safe for push-based exporters that perform sequential collection.

func (*Metrics) Reset

func (m *Metrics) Reset()

Reset sets the size of every slice to zero, while maintaining capacity, to support re-use.

type Point

type Point struct {
	// Attributes are the coordinates of this series.
	Attributes attribute.Set

	// Temporality applies to instruments that have it defined
	// (which excludes the asynchronous gauge).
	Temporality aggregation.Temporality

	// Aggregation determines the kind of data point
	// recorded in this series.
	Aggregation aggregation.Aggregation

	// Start indicates the start of the collection
	// interval reflected in this series, which is set
	// according to the configured temporality.
	Start time.Time

	// End indicates the moment at which the collection
	// was performed.
	End time.Time
}

Point is a timeseries data point resulting from a single collection.

type Scope

type Scope struct {
	// Library describes the instrumentation scope.
	Library instrumentation.Library

	// Instruments is a slice of metric data, one per Instrument
	// in the scope.
	Instruments []Instrument
}

Scope is the result of a single collection for a single Meter.

See the comments on Metrics about re-use of slices in this struct.

func (*Scope) Reset

func (s *Scope) Reset()

Reset sets the size of every slice to zero, while maintaining capacity, to support re-use.

type Sequence

type Sequence struct {
	// Start is the time when the MeterProvider was initialized.
	Start time.Time
	// Last is the time when the previous collection
	// happened.  If there was no previous collection,
	// this will match Start.
	Last time.Time
	// Now is the moment the current collection began.  This value
	// will be used as the subsequent value for Last.
	Now time.Time
}

Sequence provides the three relevant timestamps that are used by the SDK during collection. Depending on aggregation temporality, either `Start` or `Last` will be used.

Jump to

Keyboard shortcuts

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