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: 29 Imported by: 5

Documentation

Index

Constants

View Source
const NodeIDKey attribute.Key = "service.node.name" // ECS convention
View Source
const TxHashKey attribute.Key = "tx.hash"
View Source
const TxTypeKey attribute.Key = "tx.type"
View Source
const UnitIDKey attribute.Key = "unit_id"

Variables

This section is empty.

Functions

func ErrStatus

func ErrStatus(err error) attribute.KeyValue

ErrStatus returns attribute named "status" with value "ok" if the param err is nil and "err" when it is not.

func Partition

func Partition(id types.SystemID) attribute.KeyValue

func PeerID

func PeerID(key attribute.Key, id peer.ID) attribute.KeyValue

func Round

func Round(round uint64) attribute.KeyValue

func TxHash

func TxHash(value []byte) attribute.KeyValue

func UnitID

func UnitID(id []byte) attribute.KeyValue

Types

type Factory

type Factory struct{}

func NewFactory

func NewFactory() Factory

func (Factory) Logger

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

func (Factory) Observability

func (Factory) Observability(metrics, traces string) (MeterAndTracer, error)

type MeterAndTracer

type MeterAndTracer interface {
	Tracer(name string, options ...trace.TracerOption) trace.Tracer
	TracerProvider() trace.TracerProvider

	Meter(name string, opts ...metric.MeterOption) metric.Meter
	PrometheusRegisterer() prometheus.Registerer

	Shutdown() error
}

MeterAndTracer combines Metrics and Tracing related methods

type MeterTracerLogger

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

func WithLogger

func WithLogger(obs MeterAndTracer, log *slog.Logger) MeterTracerLogger

WithLogger combines "metrics and tracing provider" and logger into single "observability provider". It is mostly meant to be used to "replace logger" in the situations where sublogger is created (ie logger.With) for a scope and needs to be passed as single observability parameter.

func (MeterTracerLogger) Logger

func (mtl MeterTracerLogger) Logger() *slog.Logger

func (MeterTracerLogger) Meter

func (mtl MeterTracerLogger) Meter(name string, opts ...metric.MeterOption) metric.Meter

func (MeterTracerLogger) PrometheusRegisterer

func (mtl MeterTracerLogger) PrometheusRegisterer() prometheus.Registerer

func (MeterTracerLogger) Shutdown

func (mtl MeterTracerLogger) Shutdown() error

func (MeterTracerLogger) Tracer

func (mtl MeterTracerLogger) Tracer(name string, options ...trace.TracerOption) trace.Tracer

func (MeterTracerLogger) TracerProvider

func (mtl MeterTracerLogger) TracerProvider() trace.TracerProvider

Jump to

Keyboard shortcuts

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