metrics

package
v0.0.0-...-bb20dc4 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOrRegister

func GetOrRegister(name string, i interface{}) interface{}

Gets an existing metric or creates and registers a new one. Threadsafe alternative to calling Get and Register on failure.

func Register

func Register(name string, i interface{}) error

Register the given metric under the given name. Returns a DuplicateMetric if a metric by the given name is already registered.

func Snapshot

func Snapshot() (c map[string]int64)

Types

type Counter

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

A Counter is a thread-safe counter implementation

func NewCounter

func NewCounter(key string) *Counter

func (*Counter) Add

func (c *Counter) Add(val int64)

Increment the counter by some value

func (*Counter) Set

func (c *Counter) Set(val int64)

func (*Counter) String

func (c *Counter) String() string

func (*Counter) Value

func (c *Counter) Value() int64

Return the counter's current value

type Registry

type Registry struct {
	// contains filtered or unexported fields
}
var DefaultRegistry *Registry = NewRegistry()

func NewRegistry

func NewRegistry() *Registry

Create a new registry.

func (*Registry) GetOrRegister

func (r *Registry) GetOrRegister(name string, i interface{}) interface{}

func (*Registry) Register

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

Jump to

Keyboard shortcuts

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