observability

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: AGPL-3.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 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 NOPObservability

func NOPObservability() *Observability

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

func New

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

func (*Observability) Factory

func (o *Observability) Factory() Factory

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