metrics

package
v0.0.0-...-7ede39d Latest Latest
Warning

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

Go to latest
Published: May 3, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	NewReporter(logger zap.Logger) (Reporter, error)
}

Config is an interface for creating metrics-specific stats reporters.

type Opt

type Opt interface {
	UnmarshalConfig(data []byte, fname string, logger zap.Logger) (Config, error)
}

Opt is an interface for config unmarshaled in local configuration files.

type Reporter

type Reporter interface {
	// ReportCounter reports a counter value
	ReportCounter(name string, tags Tags, value int64)

	// ReportGauge reports a gauge value
	ReportGauge(name string, tags Tags, value int64)

	// RecordTimer
	RecordTimer(name string, tags Tags, d time.Duration)

	// Flush is expected to be called by a Scope when it completes a round or reporting
	Flush()

	// Close conducts a clean exit for the stats reporting.
	Close() error
}

Reporter is an interface for stats reporting functions. Its methods take optional tag dictionaries which may be ignored by concrete implementations.

type StatsdConfig

type StatsdConfig struct {
	Metrics struct {
		Statsd *statsdFileConfig `yaml:"statsd"`
	} `yaml:"metrics"`
}

StatsdConfig implements metrics.Config.

func (StatsdConfig) NewReporter

func (c StatsdConfig) NewReporter(logger zap.Logger) (Reporter, error)

NewReporter creates a new metrics backend talking to Statsd.

type StatsdConfiger

type StatsdConfiger struct{}

StatsdConfiger implements metrics.Opt.

func (StatsdConfiger) UnmarshalConfig

func (c StatsdConfiger) UnmarshalConfig(data []byte, fname string, logger zap.Logger) (Config, error)

UnmarshalConfig fetches the configuration file from local path.

type Tags

type Tags map[string]string

Tags is an alias of map[string]string, a type for tags associated with a statistic.

Jump to

Keyboard shortcuts

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