telemetry

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResource

func NewResource(ctx context.Context, opts Options) (*resource.Resource, error)

NewResource creates a new OpenTelemetry resource with service information. It automatically detects process, OS, container, and host information.

Types

type Option

type Option func(*Options) error

Option is a functional option for configuring OpenTelemetry providers.

func WithEnvironment

func WithEnvironment(env string) Option

WithEnvironment sets the deployment environment. Defaults to "development" if not set.

func WithExportInterval

func WithExportInterval(interval time.Duration) Option

WithExportInterval sets the interval for periodic metric exports. Defaults to 60 seconds if not set or zero. Only used by metrics provider.

func WithExporterTimeout

func WithExporterTimeout(timeout time.Duration) Option

WithExporterTimeout sets the timeout for exporter operations. Defaults to 10 seconds if not set or zero.

func WithExporterURL

func WithExporterURL(url string) Option

WithExporterURL sets the OTLP exporter endpoint URL (required).

func WithInsecure

func WithInsecure(insecure bool) Option

WithInsecure sets whether to use insecure connection. Should be true for local development, false for production.

func WithServiceName

func WithServiceName(name string) Option

WithServiceName sets the service name (required).

func WithServiceVersion

func WithServiceVersion(version string) Option

WithServiceVersion sets the service version. Defaults to "unknown" if not set.

type Options

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

Options contains shared configuration for OpenTelemetry providers.

func NewOptions

func NewOptions(opts ...Option) (Options, error)

NewOptions creates a new Options with the provided functional options.

func (Options) Environment

func (o Options) Environment() string

func (Options) ExportInterval

func (o Options) ExportInterval() time.Duration

func (Options) ExporterTimeout

func (o Options) ExporterTimeout() time.Duration

func (Options) ExporterURL

func (o Options) ExporterURL() string

func (Options) Insecure

func (o Options) Insecure() bool

func (Options) ServiceName

func (o Options) ServiceName() string

func (Options) ServiceVersion

func (o Options) ServiceVersion() string

type ShutdownFunc

type ShutdownFunc func(context.Context) error

ShutdownFunc is a function that shuts down an OpenTelemetry provider. It should be called when the application exits to ensure all telemetry data is flushed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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