observability

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package observability provides unified configuration and initialization for the four observability pillars: logging, metrics, tracing, and profiling.

Index

Constants

This section is empty.

Variables

View Source
var (
	O11yProviders = wire.NewSet(
		wire.FieldsOf(
			new(*Config),
			"Logging",
			"Metrics",
			"Tracing",
			"Profiling",
		),
	)
)

Functions

func AcknowledgeError

func AcknowledgeError(err error, logger logging.Logger, span tracing.Span, descriptionFmt string, descriptionArgs ...any)

AcknowledgeError standardizes our error handling by logging and tracing consistently.

func ObserveValues

func ObserveValues(values map[string]any, span tracing.Span, logger logging.Logger) logging.Logger

func PrepareAndLogError

func PrepareAndLogError(err error, logger logging.Logger, span tracing.Span, descriptionFmt string, descriptionArgs ...any) error

PrepareAndLogError standardizes our error handling by logging, tracing, and formatting an error consistently.

func PrepareAndLogGRPCStatus

func PrepareAndLogGRPCStatus(err error, logger logging.Logger, span tracing.Span, code codes.Code, descriptionFmt string, descriptionArgs ...any) error

PrepareAndLogGRPCStatus standardizes our error handling by logging, tracing, and formatting an error consistently.

func PrepareError

func PrepareError(err error, span tracing.Span, descriptionFmt string, descriptionArgs ...any) error

PrepareError standardizes our error handling by logging, tracing, and formatting an error consistently.

func RegisterO11yConfigs

func RegisterO11yConfigs(i do.Injector)

RegisterO11yConfigs registers sub-configs extracted from *Config with the injector. This mirrors the wire.FieldsOf pattern in wire.go. Prerequisite: *Config must be registered in the injector before calling this.

Types

type Config

type Config struct {
	Profiling profilingcfg.Config `envPrefix:"PROFILING_" json:"profiling"`
	Logging   loggingcfg.Config   `envPrefix:"LOGGING_"   json:"logging"`
	Metrics   metricscfg.Config   `envPrefix:"METRICS_"   json:"metrics"`
	Tracing   tracingcfg.Config   `envPrefix:"TRACING_"   json:"tracing"`
	// contains filtered or unexported fields
}

Config contains settings about how we report our metrics.

func (*Config) ProvidePillars

func (cfg *Config) ProvidePillars(ctx context.Context) (*Pillars, error)

ProvidePillars creates and returns all four observability pillars.

func (*Config) ValidateWithContext

func (cfg *Config) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a Config struct.

type Pillars

type Pillars struct {
	Logger          logging.Logger
	TracerProvider  tracing.TracerProvider
	MetricsProvider metrics.Provider
	Profiler        profiling.Provider
}

Pillars holds the four observability pillars: logging, tracing, metrics, and profiling.

Directories

Path Synopsis
zap
Package metrics provides a metrics-tracking implementation for the service.
Package metrics provides a metrics-tracking implementation for the service.
mock
Package mockmetrics provides metrics-related mocks.
Package mockmetrics provides metrics-related mocks.
Package tracing provides distributed tracing utilities.
Package tracing provides distributed tracing utilities.
cloudtrace
Package cloudtrace provides common functions for attaching values to trace spans
Package cloudtrace provides common functions for attaching values to trace spans
oteltrace
Package oteltrace provides common functions for attaching values to trace spans
Package oteltrace provides common functions for attaching values to trace spans
Package o11yutils offers observability utility functions.
Package o11yutils offers observability utility functions.

Jump to

Keyboard shortcuts

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