registry

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Env is the environment identifier injected to the internally managed
	// registry interface to annotate all metrics with the respective label, e.g.
	// "env=staging".
	Env string

	// Fil is an optional error matcher to ignore certain errors returned by the
	// executed worker handlers, in order to suppress their associated error logs.
	// All errors will be logged by default.
	Fil func(error) bool

	// Log is a standard logger interface to forward structured log messages to
	// any output interface e.g. stdout.
	Log logger.Interface

	// Met is the open telemetry meter interface injected to the internally
	// managed registry interface. This meter will record all worker handler
	// execution metrics.
	Met metric.Meter
}

type Registry

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

Registry contains all necessary information to wrap user specific worker handlers within new metrics handlers when instantiating a new worker engine.

func New

func New(c Config) *Registry

func (*Registry) Log

func (r *Registry) Log(err error) bool

Log returns the result of the configured filter function transparently. Exposing the injected filter here allows any worker handler to understand the same behaviour implemented inside of the metrics handler. E.g. an error intended to cancel the reconciliation loop should neither be considered a failure inside the metrics handler, as well as inside the worker engine.

func (*Registry) New

func (r *Registry) New(han handler.Ensure) handler.Interface

New returns a metrics handler by wrapping the given implementation of handler.Ensure within a proxy handler. The returned metrics handler is configured with its own metrics registry according to the underlying configuration.

Jump to

Keyboard shortcuts

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