observability

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package observability provides structured logging and optional telemetry integration for versionconductor using omniobserve.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func L

func L(ctx context.Context) *slog.Logger

L is a shorthand for LoggerFromContext.

func LoggerFromContext

func LoggerFromContext(ctx context.Context) *slog.Logger

LoggerFromContext retrieves the logger from context. Returns slog.Default() if no logger is in context.

func WithLogger

func WithLogger(ctx context.Context, logger *slog.Logger) context.Context

WithLogger adds a logger to the context.

Types

type Config

type Config struct {
	// ServiceName is the service name for telemetry.
	ServiceName string

	// ServiceVersion is the service version.
	ServiceVersion string

	// LogLevel is the minimum log level.
	LogLevel slog.Level

	// Verbose enables debug-level logging.
	Verbose bool

	// Provider is the observability provider name (otlp, newrelic, datadog).
	Provider string

	// Endpoint is the OTLP endpoint (e.g., localhost:4317).
	Endpoint string

	// APIKey is the API key for cloud providers (New Relic, Datadog).
	APIKey string

	// Disabled disables telemetry collection (local logging only).
	Disabled bool
}

Config holds observability configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a default configuration for local-only logging.

type Observability

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

Observability manages the observability stack.

func New

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

New creates a new Observability instance with the given configuration.

func (*Observability) Logger

func (o *Observability) Logger() *slog.Logger

Logger returns the configured slog.Logger.

func (*Observability) Provider

func (o *Observability) Provider() observops.Provider

Provider returns the observability provider (may be nil if disabled).

func (*Observability) Shutdown

func (o *Observability) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the observability stack.

Jump to

Keyboard shortcuts

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