metrics

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(btype, address, username, password string) error

Register inits Backend with input Type and address, puts the instantiated backend to Registry.

func Unregister

func Unregister(name string)

Unregister removes Backend from registry

Types

type Backend

type Backend interface {
	// GetType returns backend type, for example Prometheus.
	GetType() string
	// GetAddress returns backend address.
	GetAddress() string
	// QueryInstant performs instant query and returns results in model.Vector type.
	QueryInstant(ctx context.Context, query string, ts time.Time) (model.Vector, error)
}

Backend is used to interface with a metrics backend

func Get

func Get(name string) (Backend, bool)

Get returns a Backend with a given name

func GetBackend

func GetBackend(e *common.Etcd, pid string) (Backend, error)

GetBackend retrieves backend instance from a given provider id.

type Manager

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

Manager maintains a set of Backends.

func NewManager

func NewManager() *Manager

NewManager is the MetricsManager constructor.

func (*Manager) Register

func (m *Manager) Register(btype, address, username, password string) error

Register inits Backend with input Type and address, puts the instantiated backend to Registry.

type Registry

type Registry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Registry) Delete

func (r *Registry) Delete(key string)

Delete deletes the Backend with the given name from the Registry, or noops if the Backend doesn't exist. It only deletes it from the Registry; it does not clean up the underlying type.

func (*Registry) Get

func (r *Registry) Get(key string) (Backend, bool)

Get returns the Backend with the given name from the Registry

func (*Registry) Iter

func (r *Registry) Iter() <-chan RegistryItem

Iter iterates over the items in a Registry Each item is sent over a channel, so that we can iterate over the Registry using the builtin range keyword

func (*Registry) Set

func (r *Registry) Set(key string, value Backend)

Put puts a Backend with the given name into the Registry. If a Backend already exists with the given name, it will simply be overwritten.

type RegistryItem

type RegistryItem struct {
	Key   string
	Value Backend
}

Directories

Path Synopsis
backends

Jump to

Keyboard shortcuts

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