otel

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 17 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, 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 WithDefaultHistogramBucketBoundaries added in v0.10.0

func WithDefaultHistogramBucketBoundaries(boundaries []float64) MeterProviderOption

WithDefaultHistogramBucketBoundaries lets you overwrite the default buckets for all histograms.

func WithGRPCMeterProvider added in v0.11.0

func WithGRPCMeterProvider(grpcEndpoint string) MeterProviderOption

WithGRPCMeterProvider allows to set the meter provider to use GRPC

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)

func WithPrometheusExporter added in v0.11.0

func WithPrometheusExporter(registerer prometheus.Registerer) MeterProviderOption

WithPrometheusExporter allows to enable the Prometheus exporter

type Option

type Option func(*config)

Option allows to configure the OpenTelemetry initialization

func WithCustomTracerProvider added in v0.19.0

func WithCustomTracerProvider(se SpanExporter, opts ...TracerProviderOption) Option

WithCustomTracerProvider forces the usage of a custom exporter for the tracer provider

func WithInsecure

func WithInsecure() Option

WithInsecure allows to set the GRPC connection to be insecure

func WithLogger added in v0.11.0

func WithLogger(l logger) Option

WithLogger allows to set the logger

func WithMeterProvider

func WithMeterProvider(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, opts ...TracerProviderOption) Option

WithTracerProvider allows to set the tracer provider and specify if it should be the global one

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 SpanExporter added in v0.19.0

type SpanExporter = sdktrace.SpanExporter

SpanExporter can be used to set a custom span exporter (e.g. for testing purposes)

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

func WithTracingSamplingRate added in v0.19.0

func WithTracingSamplingRate(rate float64) TracerProviderOption

WithTracingSamplingRate allows to set the sampling rate for the tracer provider samplingRate >= 1 will always sample. samplingRate < 0 is treated as zero.

func WithTracingSyncer added in v0.19.0

func WithTracingSyncer() TracerProviderOption

WithTracingSyncer lets you register the exporter with a synchronous SimpleSpanProcessor (e.g. instead of a batching asynchronous one). NOT RECOMMENDED FOR PRODUCTION USE (use for testing and debugging only).

func WithZipkin added in v0.19.0

func WithZipkin() TracerProviderOption

WithZipkin allows to set the tracer provider to use Zipkin This means that the SDK will send the data to Zipkin directly instead of using the collector.

Directories

Path Synopsis
Package prometheus is imported from the official OpenTelemetry package: https://github.com/open-telemetry/opentelemetry-go/tree/v1.14.0/exporters/prometheus The version of the exporter would be v0.37.0 (not v1.14.0, see releases).
Package prometheus is imported from the official OpenTelemetry package: https://github.com/open-telemetry/opentelemetry-go/tree/v1.14.0/exporters/prometheus The version of the exporter would be v0.37.0 (not v1.14.0, see releases).

Jump to

Keyboard shortcuts

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