metrics

package
v0.0.0-...-c0686e8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TallyFlushInterval is the flush interval for metrics buffered in Tally to
	// be flushed to the backend
	TallyFlushInterval = 1 * time.Second
)

Variables

This section is empty.

Functions

func InitMetricScope

func InitMetricScope(
	cfg *Config,
	rootMetricScope string,
	metricFlushInterval time.Duration) (tally.Scope, io.Closer, *nethttp.ServeMux)

InitMetricScope initialize a root scope and its closer, with a http server mux

func SafeScopeName

func SafeScopeName(name string) string

SafeScopeName returns a safe scope name that removes dash which is not allowed in tally

Types

type Closer

type Closer func()

Closer closes the runtime metrics collection

func StartCollectingRuntimeMetrics

func StartCollectingRuntimeMetrics(
	scope tally.Scope,
	enabled bool,
	collectInterval time.Duration,
) Closer

StartCollectingRuntimeMetrics starts generating runtime metrics under given metrics scope with the collectInterval

type Config

type Config struct {
	MultiReporter  bool                   `yaml:"multi_reporter"`
	Prometheus     *prometheusConfig      `yaml:"prometheus"`
	Statsd         *statsdConfig          `yaml:"statsd"`
	M3             *tallym3.Configuration `yaml:"m3"`
	RuntimeMetrics *runtimeConfig         `yaml:"runtime_metrics"`
}

Config will be containing the metrics configuration

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 (*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.

Jump to

Keyboard shortcuts

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