otel

package
v5.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled      bool
	ServiceName  string
	BatchTimeout time.Duration
	LogWriter    io.Writer // File to write OTel logs to (required when enabled)
	Endpoint     string    // OTLP endpoint (optional, only used if set)
	Insecure     bool      // Use insecure connection for OTLP
}

Config holds OTel configuration

type Provider

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

Provider manages OpenTelemetry providers for logs and metrics

func New

func New(cfg Config) (*Provider, error)

New creates a new OTel provider with the given configuration. If OTel is disabled, returns a no-op provider.

func (*Provider) Enabled

func (p *Provider) Enabled() bool

Enabled returns whether OTel is enabled

func (*Provider) Flush

func (p *Provider) Flush(ctx context.Context) error

Flush forces a flush of all pending logs. Use this during mission save to ensure all data is exported.

func (*Provider) LoggerProvider

func (p *Provider) LoggerProvider() *sdklog.LoggerProvider

LoggerProvider returns the log provider for use with otelslog bridge. Returns nil if OTel is not enabled.

func (*Provider) Shutdown

func (p *Provider) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down all providers. Should be called when the application exits.

Jump to

Keyboard shortcuts

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