otel

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRetryConfig = RetryConfig{
	Enabled:         true,
	InitialInterval: 5 * time.Second,
	MaxInterval:     30 * time.Second,
	MaxElapsedTime:  time.Minute,
}

DefaultRetryConfig represents the default retry configuration

Functions

func NewResource

func NewResource(svcName, instanceID, svcVersion string, attrs ...attribute.KeyValue) (*resource.Resource, error)

NewResource allows the creation of an OpenTelemetry resource https://opentelemetry.io/docs/concepts/glossary/#resource

Types

type Manager

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

func (*Manager) Setup

Setup simplifies the creation of tracer and meter providers with GRPC

func (*Manager) Shutdown

func (m *Manager) Shutdown(ctx context.Context) error

Shutdown allows you to gracefully clean up after the OTel manager (e.g. close underlying gRPC connection)

type MeterProviderOption

type MeterProviderOption func(providerConfig *meterProviderConfig)

MeterProviderOption allows to configure the meter provider

func WithGlobalMeterProvider

func WithGlobalMeterProvider() MeterProviderOption

WithGlobalMeterProvider allows to set the meter provider as the global one

func WithHistogramBucketBoundaries

func WithHistogramBucketBoundaries(instrumentName, meterName string, boundaries []float64) MeterProviderOption

WithHistogramBucketBoundaries allows the creation of a view to overwrite the default buckets of a given histogram. meterName is optional.

func WithMeterProviderExportsInterval

func WithMeterProviderExportsInterval(interval time.Duration) MeterProviderOption

WithMeterProviderExportsInterval configures the intervening time between exports (if less than or equal to zero, 60 seconds is used)

type Option

type Option func(*config)

Option allows to configure the OpenTelemetry initialization

func WithInsecure

func WithInsecure() Option

WithInsecure allows to set the GRPC connection to be insecure

func WithMeterProvider

func WithMeterProvider(endpoint string, opts ...MeterProviderOption) Option

WithMeterProvider allows to set the meter provider and specify if it should be the global one plus other options.

func WithRetryConfig

func WithRetryConfig(rc RetryConfig) Option

WithRetryConfig allows to set the retry configuration

func WithTextMapPropagator

func WithTextMapPropagator(tmp propagation.TextMapPropagator) Option

WithTextMapPropagator allows to set the text map propagator e.g. propagation.TraceContext{}

func WithTracerProvider

func WithTracerProvider(endpoint string, samplingRate float64, opts ...TracerProviderOption) Option

WithTracerProvider allows to set the tracer provider and specify if it should be the global one It is also possible to configure the sampling rate: samplingRate >= 1 will always sample. samplingRate < 0 is treated as zero.

type RetryConfig

type RetryConfig struct {
	// Enabled indicates whether to not retry sending batches in case of
	// export failure.
	Enabled bool
	// InitialInterval the time to wait after the first failure before
	// retrying.
	InitialInterval time.Duration
	// MaxInterval is the upper bound on backoff interval. Once this value is
	// reached the delay between consecutive retries will always be
	// `MaxInterval`.
	MaxInterval time.Duration
	// MaxElapsedTime is the maximum amount of time (including retries) spent
	// trying to send a request/batch.  Once this value is reached, the data
	// is discarded.
	MaxElapsedTime time.Duration
}

RetryConfig defines configuration for retrying batches in case of export failure using an exponential backoff.

type TracerProviderOption

type TracerProviderOption func(providerConfig *tracerProviderConfig)

TracerProviderOption allows to configure the tracer provider

func WithGlobalTracerProvider

func WithGlobalTracerProvider() TracerProviderOption

WithGlobalTracerProvider allows to set the tracer provider as the global one

Jump to

Keyboard shortcuts

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