otel

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResource

func NewResource(ctx context.Context, config *Config) (*resource.Resource, error)

NewResource creates a shared OpenTelemetry resource for all signals (logs, traces, metrics). The resource represents the service identity and should be consistent across all telemetry signals to enable correlation in observability backends.

Types

type Config

type Config struct {
	// Endpoint is the OTLP endpoint to send telemetry to
	Endpoint string
	// Insecure disables TLS for OTLP export (useful for local development)
	Insecure bool
	// ServiceName is the name of the service
	ServiceName string
	// ServiceVersion is the version of the service
	ServiceVersion string
	// GitSHA is the git commit SHA of the build
	GitSHA string
	// GitDirty indicates if the build had uncommitted changes
	GitDirty string
}

Config holds configuration for OpenTelemetry (logs, traces, metrics)

func NewConfig

func NewConfig(gitSHA, dirty, version string) *Config

NewConfig creates OTel configuration from environment variables. gitSHA, dirty, and version should be build information injected via ldflags.

func (*Config) LogsEndpoint

func (c *Config) LogsEndpoint() string

LogsEndpoint returns the endpoint for logs, with signal-specific override support Returns empty string if no endpoint is configured (logs disabled).

func (*Config) MetricsEndpoint

func (c *Config) MetricsEndpoint() string

MetricsEndpoint returns the endpoint for metrics, with signal-specific override support Returns empty string if no endpoint is configured (metrics disabled).

func (*Config) TracesEndpoint

func (c *Config) TracesEndpoint() string

TracesEndpoint returns the endpoint for traces, with signal-specific override support Returns empty string if no endpoint is configured (traces disabled).

Jump to

Keyboard shortcuts

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