telsdk

package
v0.0.0-...-adae3a6 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MinScale defines the point at which the exponential mapping
	// function becomes useless for float64.  With scale -10, ignoring
	// subnormal values, bucket indices range from -1 to 1.
	MinScale = exponent.MinScale

	// MaxScale is the largest scale supported in this code.  Use
	// ../logarithm for larger scales.
	MaxScale = exponent.MaxScale

	// SignificandWidth is the size of an IEEE 754 double-precision
	// floating-point significand.
	SignificandWidth = exponent.SignificandWidth
	// ExponentWidth is the size of an IEEE 754 double-precision
	// floating-point exponent.
	ExponentWidth = exponent.ExponentWidth

	// SignificandMask is the mask for the significand of an IEEE 754
	// double-precision floating-point value: 0xFFFFFFFFFFFFF.
	SignificandMask = exponent.SignificandMask

	// ExponentBias is the exponent bias specified for encoding
	// the IEEE 754 double-precision floating point exponent: 1023.
	ExponentBias = exponent.ExponentBias

	// ExponentMask are set to 1 for the bits of an IEEE 754
	// floating point exponent: 0x7FF0000000000000.
	ExponentMask = exponent.ExponentMask

	// SignMask selects the sign bit of an IEEE 754 floating point
	// number.
	SignMask = exponent.SignMask

	// MinNormalExponent is the minimum exponent of a normalized
	// floating point: -1022.
	MinNormalExponent = exponent.MinNormalExponent

	// MaxNormalExponent is the maximum exponent of a normalized
	// floating point: 1023.
	MaxNormalExponent = exponent.MaxNormalExponent

	// MinValue is the smallest normal number.
	MinValue = exponent.MinValue

	// MaxValue is the largest normal number.
	MaxValue = exponent.MaxValue
)
View Source
const (
	// MinScale ensures that the ../exponent mapper is used for
	// zero and negative scale values.  Do not use the logarithm
	// mapper for scales <= 0.
	LogarithmMinScale = logarithm.MinScale

	// MaxScale is selected as the largest scale that is possible
	// in current code, considering there are 10 bits of base-2
	// exponent combined with scale-bits of range.  At this scale,
	// the growth factor is 0.0000661%.
	//
	// Scales larger than 20 complicate the logic in cmd/prebuild,
	// because math/big overflows when exponent is math.MaxInt32
	// (== the index of math.MaxFloat64 at scale=21),
	//
	// At scale=20, index values are in the interval [-0x3fe00000,
	// 0x3fffffff], having 31 bits of information.  This is
	// sensible given that the OTLP exponential histogram data
	// point uses a signed 32 bit integer for indices.
	LogarithmMaxScale = logarithm.MaxScale

	// MaxValue is the largest normal number.
	LogarithmMaxValue = logarithm.MaxValue

	// MinValue is the smallest normal number.
	LogarithmMinValue = logarithm.MinValue
)
View Source
const (
	SumKind       = aggregation.SumKind
	HistogramKind = aggregation.HistogramKind
	LastValueKind = aggregation.LastValueKind
)

Kind description constants.

View Source
const (
	// Int64Kind means that the Number stores int64.
	Int64Kind = number.Int64Kind
	// Float64Kind means that the Number stores float64.
	Float64Kind = number.Float64Kind
)
View Source
const (
	// HistogramInstrumentKind indicates a Histogram instrument.
	HistogramInstrumentKind = sdkapi.HistogramInstrumentKind
	// GaugeObserverInstrumentKind indicates an GaugeObserver instrument.
	GaugeObserverInstrumentKind = sdkapi.GaugeObserverInstrumentKind

	// CounterInstrumentKind indicates a Counter instrument.
	CounterInstrumentKind = sdkapi.CounterInstrumentKind
	// UpDownCounterInstrumentKind indicates a UpDownCounter instrument.
	UpDownCounterInstrumentKind = sdkapi.UpDownCounterInstrumentKind

	// CounterObserverInstrumentKind indicates a CounterObserver instrument.
	CounterObserverInstrumentKind = sdkapi.CounterObserverInstrumentKind
	// UpDownCounterObserverInstrumentKind indicates a UpDownCounterObserver
	// instrument.
	UpDownCounterObserverInstrumentKind = sdkapi.UpDownCounterObserverInstrumentKind
)
View Source
const (
	DefaultMaxQueueSize       = trace.DefaultMaxQueueSize
	DefaultScheduleDelay      = trace.DefaultScheduleDelay
	DefaultExportTimeout      = trace.DefaultExportTimeout
	DefaultMaxExportBatchSize = trace.DefaultMaxExportBatchSize
)

Defaults for BatchSpanProcessorOptions.

View Source
const (
	// Drop will not record the span and all attributes/events will be dropped.
	Drop SamplingDecision = trace.Drop

	// Record indicates the span's `IsRecording() == true`, but `Sampled` flag
	// *must not* be set.
	RecordOnly = trace.RecordOnly

	// RecordAndSample has span's `IsRecording() == true` and `Sampled` flag
	// *must* be set.
	RecordAndSample = trace.RecordAndSample
)

Valid sampling decisions.

View Source
const (
	// DefaultAttributeValueLengthLimit is the default maximum allowed
	// attribute value length, unlimited.
	DefaultAttributeValueLengthLimit = trace.DefaultAttributeValueLengthLimit

	// DefaultAttributeCountLimit is the default maximum number of attributes
	// a span can have.
	DefaultAttributeCountLimit = trace.DefaultAttributeCountLimit

	// DefaultEventCountLimit is the default maximum number of events a span
	// can have.
	DefaultEventCountLimit = trace.DefaultEventCountLimit

	// DefaultLinkCountLimit is the default maximum number of links a span can
	// have.
	DefaultLinkCountLimit = trace.DefaultLinkCountLimit

	// DefaultAttributePerEventCountLimit is the default maximum number of
	// attributes a span event can have.
	DefaultAttributePerEventCountLimit = trace.DefaultAttributePerEventCountLimit

	// DefaultAttributePerLinkCountLimit is the default maximum number of
	// attributes a span link can have.
	DefaultAttributePerLinkCountLimit = trace.DefaultAttributePerLinkCountLimit
)
View Source
const BasicControllerDefaultPeriod = basic.DefaultPeriod

DefaultPeriod is used for:

- the minimum time between calls to Collect() - the timeout for Export() - the timeout for Collect().

Variables

View Source
var (
	// ErrUnderflow is returned when computing the lower boundary
	// of an index that maps into a denormalized floating point value.
	ErrUnderflow = mapping.ErrUnderflow
	// ErrOverflow is returned when computing the lower boundary
	// of an index that maps into +Inf.
	ErrOverflow = mapping.ErrOverflow
)
View Source
var (
	ErrNegativeInput    = aggregation.ErrNegativeInput
	ErrNaNInput         = aggregation.ErrNaNInput
	ErrInconsistentType = aggregation.ErrInconsistentType

	// ErrNoCumulativeToDelta is returned when requesting delta
	// export kind for a precomputed sum instrument.
	ErrNoCumulativeToDelta = aggregation.ErrNoCumulativeToDelta

	// ErrNoData is returned when (due to a race with collection)
	// the Aggregator is check-pointed before the first value is set.
	// The aggregator should simply be skipped in this case.
	ErrNoData = aggregation.ErrNoData
)

Sentinel errors for Aggregation interface.

View Source
var ErrBadInstrument = metric.ErrBadInstrument

ErrBadInstrument is returned when an instrument from another SDK is attempted to be registered with this SDK.

View Source
var ErrBasicControllerStarted = basic.ErrControllerStarted

ErrBasicControllerStarted indicates that a controller was started more than once.

View Source
var ErrInconsistentState = basicProcessor.ErrInconsistentState

ErrInconsistentState is returned when the sequence of collection's starts and finishes are incorrectly balanced.

View Source
var ErrInvalidTemporality = basicProcessor.ErrInvalidTemporality

ErrInvalidTemporality is returned for unknown metric.Temporality.

View Source
var (
	// ErrPartialResource is returned by a detector when complete source
	// information for a Resource is unavailable or the source information
	// contains invalid values that are omitted from the returned Resource.
	ErrPartialResource = resource.ErrPartialResource
)
View Source
var ErrUninitializedInstrument = metric.ErrUninitializedInstrument

ErrUninitializedInstrument is returned when an instrument is used when uninitialized.

Functions

func AggregatorRangeTest

func AggregatorRangeTest(num number.Number, descriptor *APIDescriptor) error

AggregatorRangeTest is a common routine for testing for valid input values. This rejects NaN values. This rejects negative values when the metric instrument does not support negative values, including monotonic counter metrics and absolute Histogram metrics.

func Compatible

func Compatible(candidate, existing sdkapi.Descriptor) bool

Compatible determines whether two sdkapi.Descriptors are considered the same for the purpose of uniqueness checking.

func NewAPIMeasurement

func NewAPIMeasurement(inst SyncImpl, n Number)

NewAPIMeasurement constructs a single observation, a binding between an asynchronous instrument and a number.

func NewFactory

NewFactory returns a new basic CheckpointerFactory.

func NewInconsistentAggregatorError

func NewInconsistentAggregatorError(a1, a2 Aggregator) error

NewInconsistentAggregatorError formats an error describing an attempt to Checkpoint or Merge different-type aggregators. The result can be unwrapped as an ErrInconsistentType.

func NewMetricKindMismatchError

func NewMetricKindMismatchError(desc sdkapi.Descriptor) error

NewMetricKindMismatchError formats an error that describes a mismatched metric instrument definition.

func WrapMeterImpl

func WrapMeterImpl(impl MeterImpl) tel.Meter

WrapMeterImpl wraps impl to be a full implementation of a Meter.

Types

type APIDescriptor

type APIDescriptor = sdkapi.Descriptor

APIDescriptor contains all the settings that describe an instrument, including its name, metric kind, number kind, and the configurable options.

func NewAPIDescriptor

func NewAPIDescriptor(name string, ikind InstrumentKind, nkind MetricNumber, description string, u tel.MetricUnit) APIDescriptor

NewAPIDescriptor returns a Descriptor with the given contents.

type APIMeasurement

type APIMeasurement = sdkapi.Measurement

Measurement is a low-level type used with synchronous instruments as a direct interface to the SDK via `RecordBatch`.

type Accumulation

type Accumulation = export.Accumulation

Accumulation contains the exported data for a single metric instrument and attribute set, as prepared by an Accumulator for the Processor.

func NewMetricExportAccumulation

func NewMetricExportAccumulation(descriptor *APIDescriptor, attrs *tel.Set, agg Aggregator) Accumulation

NewMetricExportAccumulation allows Accumulator implementations to construct new Accumulations to send to Processors. The Descriptor, attributes, and Aggregator represent aggregate metric events received over a single collection period.

type Aggregator

type Aggregator = aggregator.Aggregator

Aggregator implements a specific aggregation behavior, e.g., a behavior to track a sequence of updates to an instrument. Counter instruments commonly use a simple Sum aggregator, but for the distribution instruments (Histogram, GaugeObserver) there are a number of possible aggregators with different cost and accuracy tradeoffs.

Note that any Aggregator may be attached to any instrument--this is the result of the OpenTelemetry API/SDK separation. It is possible to attach a Sum aggregator to a Histogram instrument.

type AggregatorKind

type AggregatorKind = aggregation.Kind

AggregatorKind is a short name for the Aggregator that produces an Aggregation, used for descriptive purpose only. Kind is a string to allow user-defined Aggregators.

When deciding how to handle an Aggregation, Exporters are encouraged to decide based on conversion to the above interfaces based on strength, not on Kind value, when deciding how to expose metric data. This enables user-supplied Aggregators to replace builtin Aggregators.

For example, test for a Histogram before testing for a Sum, and so on.

type AggregatorSelector

type AggregatorSelector = export.AggregatorSelector

AggregatorSelector supports selecting the kind of Aggregator to use at runtime for a specific metric instrument.

func NewWithHistogramDistribution

func NewWithHistogramDistribution(options ...HistogramOption) AggregatorSelector

NewWithHistogramDistribution returns a simple aggregator selector that uses histogram aggregators for `Histogram` instruments. This selector is a good default choice for most metric exporters.

func NewWithInexpensiveDistribution

func NewWithInexpensiveDistribution() AggregatorSelector

NewWithInexpensiveDistribution returns a simple aggregator selector that uses minmaxsumcount aggregators for `Histogram` instruments. This selector is faster and uses less memory than the others in this package because minmaxsumcount aggregators maintain the least information about the distribution among these choices.

type AsyncBatchRunner

type AsyncBatchRunner = sdkapi.AsyncBatchRunner

AsyncBatchRunner is an interface implemented by batch-observer callbacks.

type AsyncImpl

type AsyncImpl = sdkapi.AsyncImpl

AsyncImpl is an implementation-level interface to an asynchronous instrument (e.g., Observer instruments).

func NewNoopAsyncInstrument

func NewNoopAsyncInstrument() AsyncImpl

NewNoopAsyncInstrument returns a No-op implementation of the asynchronous instrument interface.

type AsyncRunner

type AsyncRunner = sdkapi.AsyncRunner

AsyncRunner is expected to convert into an AsyncSingleRunner or an AsyncBatchRunner. SDKs will encounter an error if the AsyncRunner does not satisfy one of these interfaces.

type AsyncSingleRunner

type AsyncSingleRunner = sdkapi.AsyncSingleRunner

AsyncSingleRunner is an interface implemented by single-observer callbacks.

type BasicController

type BasicController = basic.Controller

Controller organizes and synchronizes collection of metric data in both "pull" and "push" configurations. This supports two distinct modes:

  • Push and Pull: Start() must be called to begin calling the exporter; Collect() is called periodically by a background thread after starting the controller.
  • Pull-Only: Start() is optional in this case, to call Collect periodically. If Start() is not called, Collect() can be called manually to initiate collection

The controller supports mixing push and pull access to metric data using the export.Reader RWLock interface. Collection will be blocked by a pull request in the basic controller.

func NewBasicController

func NewBasicController(checkpointerFactory CheckpointerFactory, opts ...BasicControllerOption) *BasicController

NewBasicController constructs a Controller using the provided checkpointer factory and options (including optional exporter) to configure a metric export pipeline.

type BasicControllerOption

type BasicControllerOption = basic.Option

BasicControllerOption is the interface that applies the value to a configuration option.

func WithBasicControllerCollectPeriod

func WithBasicControllerCollectPeriod(period time.Duration) BasicControllerOption

WithCollectPeriod sets the CollectPeriod configuration option of a Config.

func WithBasicControllerCollectTimeout

func WithBasicControllerCollectTimeout(timeout time.Duration) BasicControllerOption

WithBasicControllerCollectTimeout sets the CollectTimeout configuration option of a Config.

func WithBasicControllerExporter

func WithBasicControllerExporter(exporter export.Exporter) BasicControllerOption

WithBasicControllerExporter sets the exporter configuration option of a Config.

func WithBasicControllerPushTimeout

func WithBasicControllerPushTimeout(timeout time.Duration) BasicControllerOption

WithBasicControllerPushTimeout sets the PushTimeout configuration option of a Config.

func WithBasicControllerResource

func WithBasicControllerResource(r *Resource) BasicControllerOption

WithBasicControllerResource sets the Resource configuration option of a Config by merging it with the Resource configuration in the environment.

type BasicProcessorOption

type BasicProcessorOption = basicProcessor.Option

BasicProcessorOption configures a basic processor configuration.

func WithMemory

func WithMemory(memory bool) BasicProcessorOption

WithMemory sets the memory behavior of a Processor. If this is true, the processor will report metric instruments and attribute sets that were previously reported but not updated in the most recent interval.

type BatchSpanProcessorOption

type BatchSpanProcessorOption = trace.BatchSpanProcessorOption

BatchSpanProcessorOption configures a BatchSpanProcessor.

func WithBatchTimeout

func WithBatchTimeout(delay time.Duration) BatchSpanProcessorOption

WithBatchTimeout returns a BatchSpanProcessorOption that configures the maximum delay allowed for a BatchSpanProcessor before it will export any held span (whether the queue is full or not).

func WithBlocking

func WithBlocking() BatchSpanProcessorOption

WithBlocking returns a BatchSpanProcessorOption that configures a BatchSpanProcessor to wait for enqueue operations to succeed instead of dropping data when the queue is full.

func WithExportTimeout

func WithExportTimeout(timeout time.Duration) BatchSpanProcessorOption

WithExportTimeout returns a BatchSpanProcessorOption that configures the amount of time a BatchSpanProcessor waits for an exporter to export before abandoning the export.

func WithMaxExportBatchSize

func WithMaxExportBatchSize(size int) BatchSpanProcessorOption

WithMaxExportBatchSize returns a BatchSpanProcessorOption that configures the maximum export batch size allowed for a BatchSpanProcessor.

func WithMaxQueueSize

func WithMaxQueueSize(size int) BatchSpanProcessorOption

WithMaxQueueSize returns a BatchSpanProcessorOption that configures the maximum queue size allowed for a BatchSpanProcessor.

type BatchSpanProcessorOptions

type BatchSpanProcessorOptions = trace.BatchSpanProcessorOptions

BatchSpanProcessorOptions is configuration settings for a BatchSpanProcessor.

type Buckets

type Buckets = aggregation.Buckets

Buckets represents histogram buckets boundaries and counts.

For a Histogram with N defined boundaries, e.g, [x, y, z]. There are N+1 counts: [-inf, x), [x, y), [y, z), [z, +inf].

type Checkpointer

type Checkpointer = export.Checkpointer

Checkpointer is the interface used by a Controller to coordinate the Processor with Accumulator(s) and Exporter(s). The StartCollection() and FinishCollection() methods start and finish a collection interval. Controllers call the Accumulator(s) during collection to process Accumulations.

type CheckpointerFactory

type CheckpointerFactory = export.CheckpointerFactory

CheckpointerFactory is an interface for producing configured Checkpointer instances.

type Clock

type Clock = ctime.Clock

Clock keeps track of time for a metric SDK.

type Count

type Count = aggregation.Count

Count returns the number of values that were aggregated.

type Event

type Event = trace.Event

Event is a thing that happened during a Span's lifetime.

type Exporter

type Exporter = export.Exporter

Exporter handles presentation of the checkpoint of aggregate metrics. This is the final stage of a metrics export pipeline, where metric data are formatted for a specific system.

type Histogram

type Histogram = aggregation.Histogram

Histogram returns the count of events in pre-determined buckets.

type HistogramAggregator

type HistogramAggregator = histogram.Aggregator

Aggregator observe events and counts them in pre-determined buckets. It also calculates the sum and count of all events.

func NewHistogram

func NewHistogram(cnt int, desc *APIDescriptor, opts ...HistogramOption) []HistogramAggregator

New returns a new aggregator for computing Histograms.

A Histogram observe events and counts them in pre-defined buckets. And also provides the total sum and count of all observations.

Note that this aggregator maintains each value using independent atomic operations, which introduces the possibility that checkpoints are inconsistent.

type HistogramOption

type HistogramOption = histogram.Option

HistogramOption configures a histogram config.

func HistogramWithExplicitBoundaries

func HistogramWithExplicitBoundaries(explicitBoundaries []float64) HistogramOption

HistogramWithExplicitBoundaries sets the ExplicitBoundaries configuration option of a config.

type IDGenerator

type IDGenerator = trace.IDGenerator

IDGenerator allows custom generators for TraceID and SpanID.

type InstrumentImpl

type InstrumentImpl = sdkapi.InstrumentImpl

InstrumentImpl is a common interface for synchronous and asynchronous instruments.

type InstrumentKind

type InstrumentKind = sdkapi.InstrumentKind

InstrumentKind describes the kind of instrument.

type InstrumentationLibrary

type InstrumentationLibrary = instrumentation.Library

InstrumentationLibrary represents the instrumentation library.

type InstrumentationLibraryReader

type InstrumentationLibraryReader = export.InstrumentationLibraryReader

InstrumentationLibraryReader is an interface for exporters to iterate over one instrumentation library of metric data at a time.

type LastValue

type LastValue = aggregation.LastValue

LastValue returns the latest value that was aggregated.

type LastValueAggregator

type LastValueAggregator = lastvalue.Aggregator

Aggregator aggregates lastValue events.

func NewLastValue

func NewLastValue(cnt int) []LastValueAggregator

NewLastValue returns a new lastValue aggregator. This aggregator retains the last value and timestamp that were recorded.

type Link = trace.Link

Link is the relationship between two Spans. The relationship can be within the same Trace or across different Traces.

type Mapping

type Mapping = mapping.Mapping

Mapping is the interface of an exponential histogram mapper.

func NewExponentMapping

func NewExponentMapping(scale int32) (Mapping, error)

NewExponentMapping constructs an exponential mapping function, used for scales <= 0.

func NewLogarithmMapping

func NewLogarithmMapping(scale int32) (Mapping, error)

NewLogarithmMapping constructs a logarithm mapping function, used for scales > 0.

type Metadata

type Metadata = export.Metadata

Metadata contains the common elements for exported metric data that are shared by the Accumulator->Processor and Processor->Exporter steps.

type MeterImpl

type MeterImpl = sdkapi.MeterImpl

MeterImpl is the interface an SDK must implement to supply a Meter implementation.

func UnwrapMeterImpl

func UnwrapMeterImpl(m metric.Meter) MeterImpl

UnwrapMeterImpl unwraps the Meter to its bare MeterImpl.

type MetricAccumulator

type MetricAccumulator = metric.Accumulator

MetricAccumulator implements the OpenTelemetry Meter API. The Accumulator is bound to a single export.Processor in `NewAccumulator()`.

The Accumulator supports a Collect() API to gather and export current data. Collect() should be arranged according to the processor model. Push-based processors will setup a timer to call Collect() periodically. Pull-based processors will call Collect() when a pull request arrives.

func NewMetricAccumulator

func NewMetricAccumulator(processor MetricExportProcessor) *MetricAccumulator

NewMetricAccumulator constructs a new Accumulator for the given processor. This Accumulator supports only a single processor.

The Accumulator does not start any background process to collect itself periodically, this responsibility lies with the processor, typically, depending on the type of export. For example, a pull-based processor will call Collect() when it receives a request to scrape current metric values. A push-based processor should configure its own periodic collection.

type MetricExportAggregation

type MetricExportAggregation = aggregation.Aggregation

Aggregation is an interface returned by the Aggregator containing an interval of metric data.

type MetricExportProcessor

type MetricExportProcessor = export.Processor

MetricExportProcessor is responsible for deciding which kind of aggregation to use (via AggregatorSelector), gathering exported results from the SDK during collection, and deciding over which dimensions to group the exported data.

The SDK supports binding only one of these interfaces, as it has the sole responsibility of determining which Aggregator to use for each record.

The embedded AggregatorSelector interface is called (concurrently) in instrumentation context to select the appropriate Aggregator for an instrument.

The `Process` method is called during collection in a single-threaded context from the SDK, after the aggregator is checkpointed, allowing the processor to build the set of metrics currently being exported.

type MetricNumber

type MetricNumber = number.Kind

MetricNumber describes the data type of the Number.

type Number

type Number = number.Number

Number represents either an integral or a floating point value. It needs to be accompanied with a source of Kind that describes the actual type of the value stored within Number.

func NewFloat64Number

func NewFloat64Number(f float64) Number

NewFloat64Number creates a floating point Number.

func NewInt64Number

func NewInt64Number(i int64) Number

NewInt64Number creates an integral Number.

func NewNumberFromRaw

func NewNumberFromRaw(r uint64) Number

NewNumberFromRaw creates a new Number from a raw value.

func NewNumberSignChange

func NewNumberSignChange(kind MetricNumber, nn Number) Number

NewNumberSignChange returns a number with the same magnitude and the opposite sign. `kind` must describe the kind of number in `nn`.

type Observation

type Observation = sdkapi.Observation

Observation is a low-level type used with asynchronous instruments as a direct interface to the SDK via `BatchObserver`.

func NewObservation

func NewObservation(inst AsyncImpl, n Number) Observation

NewObservation constructs a single observation, a binding between an asynchronous instrument and a number.

type ParentBasedSamplerOption

type ParentBasedSamplerOption = trace.ParentBasedSamplerOption

ParentBasedSamplerOption configures the sampler for a particular sampling case.

func WithLocalParentNotSampled

func WithLocalParentNotSampled(s Sampler) ParentBasedSamplerOption

WithLocalParentNotSampled sets the sampler for the case of local parent which is not sampled.

func WithLocalParentSampled

func WithLocalParentSampled(s Sampler) ParentBasedSamplerOption

WithLocalParentSampled sets the sampler for the case of sampled local parent.

func WithRemoteParentNotSampled

func WithRemoteParentNotSampled(s Sampler) ParentBasedSamplerOption

WithRemoteParentNotSampled sets the sampler for the case of remote parent which is not sampled.

func WithRemoteParentSampled

func WithRemoteParentSampled(s Sampler) ParentBasedSamplerOption

WithRemoteParentSampled sets the sampler for the case of sampled remote parent.

type Processor

type Processor = basicProcessor.Processor

Processor is a basic metric processor.

func New

New returns a basic Processor that is also a Checkpointer using the provided AggregatorSelector to select Aggregators. The TemporalitySelector is consulted to determine the kind(s) of exporter that will consume data, so that this Processor can prepare to compute Cumulative Aggregations as needed.

type ReadOnlySpan

type ReadOnlySpan = trace.ReadOnlySpan

ReadOnlySpan allows reading information from the data structure underlying a trace.Span. It is used in places where reading information from a span is necessary but changing the span isn't necessary or allowed.

Warning: methods may be added to this interface in minor releases.

type ReadWriteSpan

type ReadWriteSpan = trace.ReadWriteSpan

ReadWriteSpan exposes the same methods as trace.Span and in addition allows reading information from the underlying data structure. This interface exposes the union of the methods of trace.Span (which is a "write-only" span) and ReadOnlySpan. New methods for writing or reading span information should be added under trace.Span or ReadOnlySpan, respectively.

Warning: methods may be added to this interface in minor releases.

type Reader

type Reader = export.Reader

Reader allows a controller to access a complete checkpoint of aggregated metrics from the Processor for a single library of metric data. This is passed to the Exporter which may then use ForEach to iterate over the collection of aggregated metrics.

type RealClock

type RealClock = ctime.RealClock

RealClock wraps the time package and uses the system time to tell time.

type RealTicker

type RealTicker = ctime.RealTicker

RealTicker wraps the time package and uses system time to tick time intervals.

type Record

type Record = export.Record

Record contains the exported data for a single metric instrument and attribute set, as prepared by the Processor for the Exporter. This includes the effective start and end time for the aggregation.

func NewRecord

func NewRecord(descriptor *APIDescriptor, attrs *tel.Set, agg MetricExportAggregation, start, end time.Time) Record

NewRecord allows Processor implementations to construct export records. The Descriptor, attributes, and Aggregator represent aggregate metric events received over a single collection period.

type ReducerAttributeFilterSelector

type ReducerAttributeFilterSelector = reducer.AttributeFilterSelector

ReducerAttributeFilterSelector selects an attribute filter based on the instrument described by the descriptor.

type ReducerProcessor

type ReducerProcessor = reducer.Processor

ReducerProcessor implements "dimensionality reduction" by filtering keys from export attribute sets.

func NewReducer

func NewReducer(filterSelector ReducerAttributeFilterSelector, ckpter export.Checkpointer) *ReducerProcessor

NewReducer returns a dimensionality-reducing Processor that passes data to the next stage in an export pipeline.

type Resource

type Resource = resource.Resource

Resource describes an entity about which identifying information and metadata is exposed. Resource is an immutable object, equivalent to a map from key to unique value.

Resources should be passed and stored as pointers (`*resource.Resource`). The `nil` value is equivalent to an empty Resource.

func Default

func Default() *Resource

Default returns an instance of Resource with a default "service.name" and OpenTelemetrySDK attributes.

func DetectResource

func DetectResource(ctx context.Context, detectors ...ResourceDetector) (*Resource, error)

DetectResource calls all input detectors sequentially and merges each result with the previous one. It returns the merged error too.

func Empty

func Empty() *Resource

Empty returns an instance of Resource with no attributes. It is equivalent to a `nil` Resource.

func Environment

func Environment() *Resource

Environment returns an instance of Resource with attributes extracted from the OTEL_RESOURCE_ATTRIBUTES environment variable.

func Merge

func Merge(a, b *Resource) (*Resource, error)

Merge creates a new resource by combining resource a and b.

If there are common keys between resource a and b, then the value from resource b will overwrite the value from resource a, even if resource b's value is empty.

The SchemaURL of the resources will be merged according to the spec rules: https://github.com/open-telemetry/opentelemetry-specification/blob/bad49c714a62da5493f2d1d9bafd7ebe8c8ce7eb/specification/resource/sdk.md#merge If the resources have different non-empty schemaURL an empty resource and an error will be returned.

func NewResource

func NewResource(ctx context.Context, opts ...ResourceOption) (*Resource, error)

NewResource returns a Resource combined from the user-provided detectors.

func NewSchemaless

func NewSchemaless(attrs ...attribute.KeyValue) *Resource

NewSchemaless creates a resource from attrs. If attrs contains duplicate keys, the last value will be used. If attrs contains any invalid items those items will be dropped. The resource will not be associated with a schema URL. If the schema of the attrs is known use NewWithAttributes instead.

func NewWithAttributes

func NewWithAttributes(schemaURL string, attrs ...attribute.KeyValue) *Resource

NewWithAttributes creates a resource from attrs and associates the resource with a schema URL. If attrs contains duplicate keys, the last value will be used. If attrs contains any invalid items those items will be dropped. The attrs are assumed to be in a schema identified by schemaURL.

type ResourceDetector

type ResourceDetector = resource.Detector

ResourceDetector detects OpenTelemetry resource information.

type ResourceOption

type ResourceOption = resource.Option

ResourceOption is the interface that applies a configuration option.

func WithAttributes

func WithAttributes(attributes ...attribute.KeyValue) ResourceOption

WithAttributes adds attributes to the configured Resource.

func WithContainer

func WithContainer() ResourceOption

WithContainer adds all the Container attributes to the configured Resource. See individual WithContainer* functions to configure specific attributes.

func WithContainerID

func WithContainerID() ResourceOption

WithContainerID adds an attribute with the id of the container to the configured Resource.

func WithDetectors

func WithDetectors(detectors ...ResourceDetector) ResourceOption

WithDetectors adds detectors to be evaluated for the configured resource.

func WithFromEnv

func WithFromEnv() ResourceOption

WithFromEnv adds attributes from environment variables to the configured resource.

func WithHost

func WithHost() ResourceOption

WithHost adds attributes from the host to the configured resource.

func WithOS

func WithOS() ResourceOption

WithOS adds all the OS attributes to the configured Resource. See individual WithOS* functions to configure specific attributes.

func WithOSDescription

func WithOSDescription() ResourceOption

WithOSDescription adds an attribute with the operating system description to the configured Resource. The formatted string is equivalent to the output of the `uname -snrvm` command.

func WithOSType

func WithOSType() ResourceOption

WithOSType adds an attribute with the operating system type to the configured Resource.

func WithProcess

func WithProcess() ResourceOption

WithProcess adds all the Process attributes to the configured Resource.

Warning! This option will include process command line arguments. If these contain sensitive information it will be included in the exported resource.

This option is equivalent to calling WithProcessPID, WithProcessExecutableName, WithProcessExecutablePath, WithProcessCommandArgs, WithProcessOwner, WithProcessRuntimeName, WithProcessRuntimeVersion, and WithProcessRuntimeDescription. See each option function for information about what resource attributes each includes.

func WithProcessCommandArgs

func WithProcessCommandArgs() ResourceOption

WithProcessCommandArgs adds an attribute with all the command arguments (including the command/executable itself) as received by the process to the configured Resource.

Warning! This option will include process command line arguments. If these contain sensitive information it will be included in the exported resource.

func WithProcessExecutableName

func WithProcessExecutableName() ResourceOption

WithProcessExecutableName adds an attribute with the name of the process executable to the configured Resource.

func WithProcessExecutablePath

func WithProcessExecutablePath() ResourceOption

WithProcessExecutablePath adds an attribute with the full path to the process executable to the configured Resource.

func WithProcessOwner

func WithProcessOwner() ResourceOption

WithProcessOwner adds an attribute with the username of the user that owns the process to the configured Resource.

func WithProcessPID

func WithProcessPID() ResourceOption

WithProcessPID adds an attribute with the process identifier (PID) to the configured Resource.

func WithProcessRuntimeDescription

func WithProcessRuntimeDescription() ResourceOption

WithProcessRuntimeDescription adds an attribute with an additional description about the runtime of the process to the configured Resource.

func WithProcessRuntimeName

func WithProcessRuntimeName() ResourceOption

WithProcessRuntimeName adds an attribute with the name of the runtime of this process to the configured Resource.

func WithProcessRuntimeVersion

func WithProcessRuntimeVersion() ResourceOption

WithProcessRuntimeVersion adds an attribute with the version of the runtime of this process to the configured Resource.

func WithSchemaURL

func WithSchemaURL(schemaURL string) ResourceOption

WithSchemaURL sets the schema URL for the configured resource.

func WithTelemetrySDK

func WithTelemetrySDK() ResourceOption

WithTelemetrySDK adds TelemetrySDK version info to the configured resource.

type Sampler

type Sampler = trace.Sampler

Sampler decides whether a trace should be sampled and exported.

func AlwaysSample

func AlwaysSample() Sampler

AlwaysSample returns a Sampler that samples every trace. Be careful about using this sampler in a production application with significant traffic: a new trace will be started and exported for every request.

func NeverSample

func NeverSample() Sampler

NeverSample returns a Sampler that samples no traces.

func ParentBased

func ParentBased(root Sampler, samplers ...ParentBasedSamplerOption) Sampler

ParentBased returns a composite sampler which behaves differently, based on the parent of the span. If the span has no parent, the root(Sampler) is used to make sampling decision. If the span has a parent, depending on whether the parent is remote and whether it is sampled, one of the following samplers will apply: - remoteParentSampled(Sampler) (default: AlwaysOn) - remoteParentNotSampled(Sampler) (default: AlwaysOff) - localParentSampled(Sampler) (default: AlwaysOn) - localParentNotSampled(Sampler) (default: AlwaysOff)

func TraceIDRatioBased

func TraceIDRatioBased(fraction float64) Sampler

TraceIDRatioBased samples a given fraction of traces. Fractions >= 1 will always sample. Fractions < 0 are treated as zero. To respect the parent trace's `SampledFlag`, the `TraceIDRatioBased` sampler should be used as a delegate of a `Parent` sampler.

type SamplingDecision

type SamplingDecision = trace.SamplingDecision

SamplingDecision indicates whether a span is dropped, recorded and/or sampled.

type SamplingParameters

type SamplingParameters = trace.SamplingParameters

SamplingParameters contains the values passed to a Sampler.

type SamplingResult

type SamplingResult = trace.SamplingResult

SamplingResult conveys a SamplingDecision, set of Attributes and a Tracestate.

type SpanExporter

type SpanExporter = trace.SpanExporter

SpanExporter handles the delivery of spans to external receivers. This is the final component in the trace export pipeline.

type SpanLimits

type SpanLimits = trace.SpanLimits

SpanLimits represents the limits of a span.

func NewSpanLimits

func NewSpanLimits() SpanLimits

NewSpanLimits returns a SpanLimits with all limits set to the value their corresponding environment variable holds, or the default if unset.

• AttributeValueLengthLimit: OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT (default: unlimited)

• AttributeCountLimit: OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT (default: 128)

• EventCountLimit: OTEL_SPAN_EVENT_COUNT_LIMIT (default: 128)

• AttributePerEventCountLimit: OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT (default: 128)

• LinkCountLimit: OTEL_SPAN_LINK_COUNT_LIMIT (default: 128)

• AttributePerLinkCountLimit: OTEL_LINK_ATTRIBUTE_COUNT_LIMIT (default: 128)

type SpanProcessor

type SpanProcessor = trace.SpanProcessor

SpanProcessor is a processing pipeline for spans in the trace signal. SpanProcessors registered with a TracerProvider and are called at the start and end of a Span's lifecycle, and are called in the order they are registered.

func NewBatchSpanProcessor

func NewBatchSpanProcessor(exporter SpanExporter, options ...BatchSpanProcessorOption) SpanProcessor

NewBatchSpanProcessor creates a new SpanProcessor that will send completed span batches to the exporter with the supplied options.

If the exporter is nil, the span processor will preform no action.

func NewSimpleSpanProcessor

func NewSimpleSpanProcessor(exporter SpanExporter) SpanProcessor

NewSimpleSpanProcessor returns a new SpanProcessor that will synchronously send completed spans to the exporter immediately.

This SpanProcessor is not recommended for production use. The synchronous nature of this SpanProcessor make it good for testing, debugging, or showing examples of other feature, but it will be slow and have a high computation resource usage overhead. The BatchSpanProcessor is recommended for production use instead.

type Sum

type Sum = aggregation.Sum

Sum returns an aggregated sum.

type SumAggregator

type SumAggregator = sum.Aggregator

SumAggregator aggregates counter events.

func NewSumAggregator

func NewSumAggregator(cnt int) []SumAggregator

NewAggregator returns a new counter aggregator implemented by atomic operations. This aggregator implements the aggregation.Sum export interface.

type SyncImpl

type SyncImpl = sdkapi.SyncImpl

SyncImpl is the implementation-level interface to a generic synchronous instrument (e.g., Histogram and Counter instruments).

func NewNoopSyncInstrument

func NewNoopSyncInstrument() SyncImpl

NewNoopSyncInstrument returns a No-op implementation of the synchronous instrument interface.

type Ticker

type Ticker = ctime.Ticker

Ticker signals time intervals.

type TraceStatus

type TraceStatus = trace.Status

TraceStatus is the classified state of a Span.

type TracerProvider

type TracerProvider = trace.TracerProvider

TracerProvider is an OpenTelemetry TracerProvider. It provides Tracers to instrumentation so it can trace operational flow through a system.

func NewTracerProvider

func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider

The passed opts are used to override these default values and configure the returned TracerProvider appropriately.

type TracerProviderOption

type TracerProviderOption = trace.TracerProviderOption

TracerProviderOption configures a TracerProvider.

func WithBatcher

WithBatcher registers the exporter with the TracerProvider using a BatchSpanProcessor configured with the passed opts.

func WithIDGenerator

func WithIDGenerator(g IDGenerator) TracerProviderOption

WithIDGenerator returns a TracerProviderOption that will configure the IDGenerator g as a TracerProvider's IDGenerator. The configured IDGenerator is used by the Tracers the TracerProvider creates to generate new Span and Trace IDs.

If this option is not used, the TracerProvider will use a random number IDGenerator by default.

func WithRawSpanLimits

func WithRawSpanLimits(limits SpanLimits) TracerProviderOption

WithRawSpanLimits returns a TracerProviderOption that configures a TracerProvider to use these limits. These limits bound any Span created by a Tracer from the TracerProvider.

The limits will be used as-is. Zero or negative values will not be changed to the default value like WithSpanLimits does. Setting a limit to zero will effectively disable the related resource it limits and setting to a negative value will mean that resource is unlimited. Consequentially, this means that the zero-value SpanLimits will disable all span resources. Because of this, limits should be constructed using NewSpanLimits and updated accordingly.

If this or WithSpanLimits are not provided, the TracerProvider will use the limits defined by environment variables, or the defaults if unset. Refer to the NewSpanLimits documentation for information about this relationship.

func WithResource

func WithResource(r *resource.Resource) TracerProviderOption

WithResource returns a TracerProviderOption that will configure the Resource r as a TracerProvider's Resource. The configured Resource is referenced by all the Tracers the TracerProvider creates. It represents the entity producing telemetry.

If this option is not used, the TracerProvider will use the resource.Default() Resource by default.

func WithSampler

func WithSampler(s Sampler) TracerProviderOption

WithSampler returns a TracerProviderOption that will configure the Sampler s as a TracerProvider's Sampler. The configured Sampler is used by the Tracers the TracerProvider creates to make their sampling decisions for the Spans they create.

This option overrides the Sampler configured through the OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG environment variables. If this option is not used and the sampler is not configured through environment variables or the environment contains invalid/unsupported configuration, the TracerProvider will use a ParentBased(AlwaysSample) Sampler by default.

func WithSpanLimits deprecated

func WithSpanLimits(sl SpanLimits) TracerProviderOption

WithSpanLimits returns a TracerProviderOption that configures a TracerProvider to use the SpanLimits sl. These SpanLimits bound any Span created by a Tracer from the TracerProvider.

If any field of sl is zero or negative it will be replaced with the default value for that field.

If this or WithRawSpanLimits are not provided, the TracerProvider will use the limits defined by environment variables, or the defaults if unset. Refer to the NewSpanLimits documentation for information about this relationship.

Deprecated: Use WithRawSpanLimits instead which allows setting unlimited and zero limits. This option will be kept until the next major version incremented release.

func WithSpanProcessor

func WithSpanProcessor(sp SpanProcessor) TracerProviderOption

WithSpanProcessor registers the SpanProcessor with a TracerProvider.

func WithSyncer

func WithSyncer(e SpanExporter) TracerProviderOption

WithSyncer registers the exporter with the TracerProvider using a SimpleSpanProcessor.

This is not recommended for production use. The synchronous nature of the SimpleSpanProcessor that will wrap the exporter make it good for testing, debugging, or showing examples of other feature, but it will be slow and have a high computation resource usage overhead. The WithBatcher option is recommended for production use instead.

type UniqueInstrumentMeterImpl

type UniqueInstrumentMeterImpl = registry.UniqueInstrumentMeterImpl

UniqueInstrumentMeterImpl implements the metric.MeterImpl interface, adding uniqueness checking for instrument descriptors.

func NewUniqueInstrumentMeterImpl

func NewUniqueInstrumentMeterImpl(impl sdkapi.MeterImpl) *UniqueInstrumentMeterImpl

NewUniqueInstrumentMeterImpl returns a wrapped metric.MeterImpl with the addition of instrument name uniqueness checking.

Jump to

Keyboard shortcuts

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