observability

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

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

func NOPFactory

func NOPFactory(t *testing.T) Factory

NOPFactory returns observability factory implementation where everything returned is no-op.

func NewFactory

func NewFactory(t *testing.T) Factory

NewFactory returns observability implementation fot test "t" based on (global) configuration (ie environment variables).

func (Factory) DefaultLogger

func (f Factory) DefaultLogger() *slog.Logger

DefaultLogger is a helper to get logger out of factory without needing to provide parameters (ie defaults are used) and handle error return value (panics in case of error).

func (Factory) DefaultObserver

func (f Factory) DefaultObserver() observability.MeterAndTracer

DefaultObserver is a helper to get metrics and tracer out of factory without needing to provide parameters (ie defaults are used) and handle error return value (panics in case of error).

func (Factory) Logger

func (f Factory) Logger(cfg *logger.LogConfiguration) (*slog.Logger, error)

func (Factory) Observability

func (f Factory) Observability(metrics, traces string) (observability.MeterAndTracer, error)

type Observability

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

func Default

func Default(t *testing.T) *Observability

Default creates observability implementation based on environment variables.

func NOPMetrics

func NOPMetrics() *Observability

NOP creates observability implementation where everithing is no-op. Use it for tests for which it absolutely doesn't make sense to create any traces or metrics.

func New

func New(t *testing.T, metrics, traces string, logBuilder func(*logger.LogConfiguration) (*slog.Logger, error)) *Observability

func (*Observability) Logger

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

func (*Observability) Meter

func (o *Observability) Meter(name string, options ...metric.MeterOption) metric.Meter

func (*Observability) MetricsHandler

func (o *Observability) MetricsHandler() http.Handler

func (*Observability) PrometheusRegisterer

func (o *Observability) PrometheusRegisterer() prometheus.Registerer

func (*Observability) Shutdown

func (o *Observability) Shutdown() error

func (*Observability) Tracer

func (o *Observability) Tracer(name string, options ...trace.TracerOption) trace.Tracer

func (*Observability) TracerProvider

func (o *Observability) TracerProvider() trace.TracerProvider

Jump to

Keyboard shortcuts

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