metrics

package
v0.0.0-...-fe0f572 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(opts Opts) (err error)

Init initializes global root metrics scope instance, all callers can only use it to extend sub scope

func Shutdown

func Shutdown() error

Shutdown closes underlying resources used by metrics server

func Start

func Start() error

Start starts metrics server

Types

type Counter

type Counter interface {
	// Inc increments the Counter by a delta.
	Inc(delta int64)
}

Counter is the interface for emitting Counter type metrics.

type Gauge

type Gauge interface {
	// Update sets the gauges absolute value.
	Update(value float64)
}

Gauge is the interface for emitting Gauge metrics.

type Opts

type Opts struct {
	Reporter           string
	Interval           time.Duration
	Enabled            bool
	StatsdReporterOpts StatsdReporterOpts
	PromReporterOpts   PromReporterOpts
}

func NewOpts

func NewOpts() Opts

NewOpts create metrics options based config file

type PromReporterOpts

type PromReporterOpts struct {
	ListenAddress string
}

type Scope

type Scope interface {

	// Counter returns the Counter object corresponding to the name.
	Counter(name string) Counter

	// Gauge returns the Gauge object corresponding to the name.
	Gauge(name string) Gauge

	// Tagged returns a new child Scope with the given tags and current tags.
	Tagged(tags map[string]string) Scope

	// SubScope returns a new child Scope appending a further name prefix.
	SubScope(name string) Scope
	// contains filtered or unexported methods
}

Scope is a namespace wrapper around a stats Reporter, ensuring that all emitted values have a given prefix or set of tags.

var RootScope Scope

type StatsdReporterOpts

type StatsdReporterOpts struct {
	Address       string
	FlushInterval time.Duration
	FlushBytes    int
}

Jump to

Keyboard shortcuts

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