observability

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ObserveVarMapName   = ":map_name"
	ObserveVarLayerName = ":layer_name"
	ObserveVarTileX     = ":x"
	ObserveVarTileY     = ":y"
	ObserveVarTileZ     = ":z"
)

Variables

View Source
var NullObserver observer.Null

Functions

func Cleanup added in v0.14.0

func Cleanup()

Cleanup should be called before shutting down the process; this allows and observers to clean, and maybe push any results it may have collected.

func InstrumentAPIHandler added in v0.14.0

func InstrumentAPIHandler(method, route string, observer APIObserver, handler http.Handler) (string, string, http.Handler)

InstrumentAPIHandler is a convenience function

func InstrumentViewerHandler added in v0.14.0

func InstrumentViewerHandler(method, route string, observer ViewerObserver, handler http.Handler) (string, string, http.Handler)

InstrumentViewHandler is a convenience function

func LabelForObserveVar added in v0.14.0

func LabelForObserveVar(key string) string

func Register

func Register(observerType string, init InitFunc, cleanup CleanUpFunc) error

Register is called by the init functions of the observers

func Registered

func Registered() []string

Registered returns the set of Registered observers

Types

type APIObserver added in v0.14.0

type APIObserver interface {
	// InstrumentedAPIHttpHandler returns an http.Handler that will instrument the given http handler, for the
	// route and method that was given
	InstrumentedAPIHttpHandler(method, route string, handler http.Handler) http.Handler
}

type Cache added in v0.14.0

type Cache interface {
	tegolaCache.Interface
	tegolaCache.Wrapped
	IsObserver() bool
}

type CacheObserver added in v0.14.0

type CacheObserver interface {
	InstrumentedCache(cacheObject tegolaCache.Interface) tegolaCache.Interface
}

type CleanUpFunc added in v0.14.0

type CleanUpFunc func()

CleanUpFunc is a function that is called before the process ends.

type Collector added in v0.14.0

type Collector = prometheus.Collector

type ErrObserverAlreadyExists

type ErrObserverAlreadyExists string

ErrObserverAlreadyExists is returned if an observer try to register to an observer type that has already registered

func (ErrObserverAlreadyExists) Error

func (err ErrObserverAlreadyExists) Error() string

type ErrObserverIsNotRegistered

type ErrObserverIsNotRegistered string

ErrObserverIsNotRegistered is returned if a requested observer type has not been already registered

func (ErrObserverIsNotRegistered) Error

func (err ErrObserverIsNotRegistered) Error() string

type InitFunc

type InitFunc func(dicter dict.Dicter) (Interface, error)

InitFunc is a function that is used to configure a observer

type Interface

type Interface interface {

	// Handler returns a http.Handler for the metrics route
	Handler(route string) http.Handler

	// Returns the name of observer
	Name() string

	// Init should setup any processing that should be done once the application is actually starting
	Init()
	// Shutdown should shutdown any subsystems that Init setup
	Shutdown()

	// MustRegister will register any custom collectors. It will panic if there is an error
	MustRegister(collectors ...Collector)

	// CollectorConfig returns the config for a given key, or nil, if the key does not exist
	CollectorConfig(key string) map[string]interface{}

	APIObserver
	ViewerObserver
	CacheObserver
}

Interface

func For

func For(observerType string, config dict.Dicter) (Interface, error)

For function returns a configured observer for the given type, and provided config map

type Observer added in v0.14.0

type Observer interface {
	// Collectors should return a set of collectors that will be registered by the default observability provider,
	// to get the configuration; use the provided function and your config key.
	Collectors(prefix string, config func(configKey string) map[string]interface{}) ([]Collector, error)
}

Observer is able to be observed via the collectors it provides

type ViewerObserver added in v0.14.0

type ViewerObserver interface {
	// InstrumentedViewerHttpHandler returns an http.Handler that will instrument the given http handler, for the
	// route and method that was given
	InstrumentedViewerHttpHandler(method, route string, handler http.Handler) http.Handler
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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