observability

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package observability provides observability features for the application.

Index

Constants

View Source
const (
	// DefaultPrometheusReadTimeout is the default timeout for reading Prometheus metrics.
	DefaultPrometheusReadTimeout = 30 * time.Second

	// DefaultPrometheusReadHeaderTimeout is the default timeout for reading Prometheus headers.
	DefaultPrometheusReadHeaderTimeout = 10 * time.Second
)

Variables

View Source
var (
	// ErrUnsupportedObservabilityType is returned when an unsupported observability type is specified.
	ErrUnsupportedObservabilityType = errors.New("unsupported observability type")

	// ErrNoImplementation is returned when no implementation is provided for the observability type.
	ErrNoImplementation = errors.New("no implementation provided for the observability type")

	// ErrInvalidPrometheusEndpoint is returned when the Prometheus endpoint is invalid.
	ErrInvalidPrometheusEndpoint = errors.New("invalid Prometheus endpoint URL")
)
View Source
var (
	// ErrUnsupportedCompressionAlgorithm is returned when an unsupported compression algorithm is specified.
	ErrUnsupportedCompressionAlgorithm = errors.New("unsupported compression algorithm")
	// ErrUnsupportedProtocol is returned when an unsupported trace protocol is specified.
	ErrUnsupportedProtocol = errors.New("unsupported trace protocol")
	// ErrInvalidTraceSampler is returned when an invalid trace sampler is specified.
	ErrInvalidTraceSampler = errors.New("invalid trace sampler")
)
View Source
var (
	// ErrNilContext is returned when a nil context is provided.
	ErrNilContext = errors.New("nil context")
	// ErrNoGinContext is returned when the provided context is not a Gin context.
	ErrNoGinContext = errors.New("no gin context")
	// ErrNoTracerInContext is returned when there is no tracer in the context.
	ErrNoTracerInContext = errors.New("no tracer in context")
	// ErrInvalidTracerInContext is returned when the tracer in the context is not valid.
	ErrInvalidTracerInContext = errors.New("invalid tracer in context")
)

Functions

func GetTracer added in v0.1.20

func GetTracer(ctx context.Context) (traceapi.Tracer, error)

GetTracer retrieves the tracer from the Gin context. It returns an error if the context is nil, not a Gin context, or does not contain a valid tracer.

Types

type Service added in v0.1.9

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

Service provides observability features such as metrics and tracing.

func New added in v0.1.9

New creates a new observability Service based on the provided settings. It provides observability service and its fields such as meter provider, trace provider, and logger for easy access.

func (*Service) Middleware added in v0.1.9

func (service *Service) Middleware() gin.HandlerFunc

Middleware returns a Gin middleware function that applies OpenTelemetry instrumentation.

type UnsupportedLogFormatError added in v0.1.20

type UnsupportedLogFormatError struct {
	LogFormat config.LogFormat
}

UnsupportedLogFormatError is an error type that indicates an unsupported log format. It contains the unsupported log format.

func (*UnsupportedLogFormatError) Error added in v0.1.20

func (e *UnsupportedLogFormatError) Error() string

Error implements the error interface for UnsupportedLogFormatError.

Jump to

Keyboard shortcuts

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