metrics

package
v1.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultReporter does not do anything
	// TODO(glib): add a logging reporter and use it by default, rather than noop
	DefaultReporter = NopCachedStatsReporter
)
View Source
var NopCachedCount tally.CachedCount = nopCachedCount{}

NopCachedCount is an implementation of tally.CachedCount and same as other Nop types don't do anything and should be used for testing purposes only.

View Source
var NopCachedGauge tally.CachedGauge = nopCachedGauge{}

NopCachedGauge is an implementation of tally.CachedGauge and same as other Nop types don't do anything and should be used for testing purposes only.

View Source
var NopCachedHistogram tally.CachedHistogram = nopCachedHistogram{}

NopCachedHistogram is an implementation of tally.CachedHistogram and same as other Nop types don't do anything and should be used for testing purposes only.

View Source
var NopCachedHistogramBucket tally.CachedHistogramBucket = nopCachedHistogramBucket{}

NopCachedHistogramBucket is an implementation of tally.CachedHistogramBucket and same as other Nop types don't do anything and should be used for testing purposes only.

View Source
var NopCachedStatsReporter tally.CachedStatsReporter = nopCachedStatsReporter{}

NopCachedStatsReporter is an implementation of tally.CachedStatsReporter that simply does nothing and should be used for testing purposes only. TODO:(anup) This should exist in tally. https://github.com/uber-go/tally/issues/23 Remove and replace metrics.NopCachedStatsReporter with tally.NopCachedStatsReporter once issue is resolved

View Source
var NopCachedTimer tally.CachedTimer = nopCachedTimer{}

NopCachedTimer is an implementation of tally.CachedTimer

Functions

func Freeze

func Freeze()

Freeze ensures that after service is started, no other metrics manipulations can be done

This has to do with the fact that modules inherit sub-scopes of the main metrics, and the fact that swapping a reporter might have unpredicted implications on already emitted metrics.

No, really, metrics must be set up before starting the service.

func RegisterRootScope

func RegisterRootScope(scopeFunc ScopeFunc)

RegisterRootScope initializes the root scope for all the service metrics

func RootScope

RootScope returns the provided metrics scope and stats reporter, or nil if not provided

Types

type RuntimeCollector

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

RuntimeCollector is a struct containing the state of the runtimeMetrics.

func NewRuntimeCollector

func NewRuntimeCollector(
	scope tally.Scope, collectInterval time.Duration,
) *RuntimeCollector

NewRuntimeCollector creates a new RuntimeCollector.

func StartCollectingRuntimeMetrics

func StartCollectingRuntimeMetrics(
	scope tally.Scope, collectInterval time.Duration, config RuntimeConfig,
) *RuntimeCollector

StartCollectingRuntimeMetrics starts generating runtime metrics under given metrics scope with given frequency. Recommended usage:

rmr := StartCollectingRuntimeMetrics(rootScope.Scope("runtime"), time.Second)
...
rmr.Close()

func (*RuntimeCollector) Close

func (r *RuntimeCollector) Close()

Close stops collecting runtime metrics. It cannot be started again after it's been stopped.

func (*RuntimeCollector) IsRunning

func (r *RuntimeCollector) IsRunning() bool

IsRunning returns true if the collector has been started and false if not.

func (*RuntimeCollector) Start

func (r *RuntimeCollector) Start()

Start starts the collector thread that periodically emits metrics.

type RuntimeConfig

type RuntimeConfig struct {
	Disabled bool `yaml:"disabled"`
}

RuntimeConfig contains configuration for initializing runtime metrics

type ScopeFunc

ScopeFunc is used during service init time to register the reporter

type ScopeInit

type ScopeInit interface {
	Name() string
	Config() config.Provider
}

ScopeInit interface provides necessary data to properly initialize root metrics scope service.Host conforms to this, but can't be used directly since it causes an import cycle

Jump to

Keyboard shortcuts

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