otlp

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package otlp constructs explicitly configured OTLP trace and metric exporters without reading vendor-specific settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMetricExporter

func NewMetricExporter(ctx context.Context, config Config) (metricexport.Exporter, error)

NewMetricExporter constructs a standard OpenTelemetry metric exporter.

func NewTraceExporter

func NewTraceExporter(ctx context.Context, config Config) (traceexport.SpanExporter, error)

NewTraceExporter constructs a standard OpenTelemetry span exporter.

Types

type Compression

type Compression string

Compression selects payload compression.

const (
	// CompressionNone disables compression.
	CompressionNone Compression = "none"
	// CompressionGZIP enables gzip compression.
	CompressionGZIP Compression = "gzip"
)

type Config

type Config struct {
	Protocol    Protocol
	Endpoint    string
	URLPath     string
	Headers     map[string]string
	Compression Compression
	TLS         TLSConfig
	Retry       RetryConfig
	Timeout     time.Duration
}

Config completely describes an OTLP exporter transport.

func (Config) Validate

func (c Config) Validate() error

Validate rejects incomplete, unsupported, or unbounded transport settings.

type Protocol

type Protocol string

Protocol selects an OTLP transport.

const (
	// ProtocolGRPC exports OTLP over gRPC.
	ProtocolGRPC Protocol = "grpc"
	// ProtocolHTTPProtobuf exports OTLP protobuf payloads over HTTP.
	ProtocolHTTPProtobuf Protocol = "http/protobuf"
)

type RetryConfig

type RetryConfig struct {
	Enabled         bool
	InitialInterval time.Duration
	MaxInterval     time.Duration
	MaxElapsedTime  time.Duration
}

RetryConfig bounds retry backoff and elapsed time.

type TLSConfig

type TLSConfig struct {
	Insecure           bool
	CAFile             string
	CertificateFile    string
	PrivateKeyFile     string
	ServerName         string
	InsecureSkipVerify bool
}

TLSConfig controls server verification and optional client certificates.

Jump to

Keyboard shortcuts

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