reporter

package
v0.0.0-...-2e0de6f Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package reporter provides default reporting functionnality.

Index

Examples

Constants

This section is empty.

Variables

View Source
var DefaultRegistry = NewRegistry()

DefaultRegistry is the default registry.

Functions

func Get

func Get(name string) interface{}

Get returns the named instruments from the default registry.

func Librato

func Librato(email, token, source string, r *Registry, d time.Duration)

Librato logs metrics to librato every given duration.

Example
registry := NewRegistry()
go Librato("account@librato.com", "<token>", "source", registry, time.Minute)
Output:

func Log

func Log(source string, r *Registry, d time.Duration)

Log logs metrics using logfmt every given duration.

Example
registry := NewRegistry()
go Log("source", registry, time.Minute)
Output:

func NewRegisteredCounter

func NewRegisteredCounter(name string) *instruments.Counter

func NewRegisteredDerive

func NewRegisteredDerive(name string, value int64) *instruments.Derive

func NewRegisteredGauge

func NewRegisteredGauge(name string, value int64) *instruments.Gauge

func NewRegisteredRate

func NewRegisteredRate(name string) *instruments.Rate

func NewRegisteredReservoir

func NewRegisteredReservoir(name string, size int64) *instruments.Reservoir

func NewRegisteredTimer

func NewRegisteredTimer(name string, size int64) *instruments.Timer

func Register

func Register(name string, v interface{}) interface{}

Register a new instruments in the default registry.

func Snapshot

func Snapshot() map[string]interface{}

Snapshot returns all instruments and reset the default registry.

func Unregister

func Unregister(name string)

Unregister remove the named instruments from the default registry.

Types

type Registry

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

Registry is a registry of all instruments.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new Register.

func (*Registry) Get

func (r *Registry) Get(name string) interface{}

Get returns an instrument from the Registry.

func (*Registry) Instruments

func (r *Registry) Instruments() map[string]interface{}

Instruments returns all instruments.

func (*Registry) Register

func (r *Registry) Register(name string, v interface{}) interface{}

Register registers a new instrument or return the existing one.

func (*Registry) Size

func (r *Registry) Size() int

Size returns the numbers of instruments in the registry.

func (*Registry) Snapshot

func (r *Registry) Snapshot() map[string]interface{}

Snapshot returns and reset all instruments.

func (*Registry) Unregister

func (r *Registry) Unregister(name string)

Unregister remove from the registry the instrument matching the given name.

Jump to

Keyboard shortcuts

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