otel

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package otel provides a lakta module for OpenTelemetry instrumentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Instance name
	Name string `koanf:"-"`

	// ServiceName specifies the OpenTelemetry service name.
	ServiceName string `koanf:"service_name"`
}

Config represents configuration for OTEL Module

func NewConfig

func NewConfig(options ...Option) Config

NewConfig returns configuration with provided options based on defaults.

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig returns default configuration

func (*Config) LoadFromKoanf

func (c *Config) LoadFromKoanf(k *koanf.Koanf, path string) error

LoadFromKoanf loads configuration from koanf instance at the given path.

type Module

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

Module manages OpenTelemetry SDK lifecycle.

func NewModule

func NewModule(options ...Option) *Module

NewModule creates a new OTEL module

func (*Module) ConfigPath

func (m *Module) ConfigPath() string

ConfigPath returns the koanf path for this module's configuration.

func (*Module) Init

func (m *Module) Init(ctx context.Context) error

Init sets up the entire OTEL provider and exporter stack

func (*Module) LoadConfig

func (m *Module) LoadConfig(k *koanf.Koanf) error

LoadConfig loads configuration from koanf.

func (*Module) Name

func (m *Module) Name() string

Name returns the instance name.

func (*Module) Shutdown

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

Shutdown gracefully stops the OTEL exporters

type Option

type Option func(m *Config)

Option configures the Module.

func WithName

func WithName(name string) Option

WithName sets the instance name for this module.

func WithServiceName added in v0.0.2

func WithServiceName(name string) Option

WithServiceName sets the OpenTelemetry service name.

Jump to

Keyboard shortcuts

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