observability

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMeter

func GetMeter(name string) metric.Meter

GetMeter returns a meter for the given name

func GetTracer

func GetTracer(name string) trace.Tracer

GetTracer returns a tracer for the given name

func Setup

func Setup(ctx context.Context, config *Config) (func(context.Context) error, error)

Setup initializes OpenTelemetry with the provided configuration. When config.OTLPEndpoint is empty, no exporters are created and a no-op shutdown function is returned. This avoids noisy connection errors when no collector is available.

Types

type Config

type Config struct {
	ServiceName    string
	ServiceVersion string
	Environment    string
	OTLPEndpoint   string
	OTLPHeaders    map[string]string
	EnableTracing  bool
	EnableMetrics  bool
	SampleRate     float64 // 0.0 to 1.0
	MetricInterval time.Duration
}

Config holds OpenTelemetry configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default OpenTelemetry configuration. OTLPEndpoint is empty by default -- set it to enable export. When OTLPEndpoint is empty, Setup() is a no-op (no exporters created).

type SparrowMetrics

type SparrowMetrics struct {
	WebhookRegistrations metric.Int64Counter
	EventsPushed         metric.Int64Counter
	WebhookDeliveries    metric.Int64Counter
	DeliveryDuration     metric.Float64Histogram
	QueueDepth           metric.Int64UpDownCounter
	ActiveWebhooks       metric.Int64UpDownCounter
}

SparrowMetrics holds application-specific metrics

func NewSparrowMetrics

func NewSparrowMetrics() (*SparrowMetrics, error)

NewSparrowMetrics creates application-specific metrics

Jump to

Keyboard shortcuts

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