metrics

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: CC0-1.0 Imports: 3 Imported by: 0

Documentation

Overview

Package metrics provides application metrics registration.

Index

Constants

This section is empty.

Variables

View Source
var StatsDPackMax = 1432

StatsDPackMax is the maximum packet size for batches. Be carefull not to exceed the network's MTU. See https://github.com/etsy/statsd/blob/master/docs/metric_types.md#multi-metric-packets

Functions

This section is empty.

Types

type Register

type Register interface {
	// Seen increments the counter with n.
	Seen(key string, n int)

	// Took adds a timing from since to now.
	Took(key string, since time.Time)

	// KeyPrefix defines a prefix applied to all keys.
	KeyPrefix(string)
}

func NewDummy

func NewDummy() Register

NewDummy returns a new Register which does nothing.

func NewStatsD

func NewStatsD(conn io.Writer, flushInterval time.Duration) Register

NewStatsD returns a new Register with a StatsD implementation. Generally speaking, you want to connect over UDP.

conn, err := net.DialTimeout("udp", "localhost:8125", 4*time.Second)
if err != nil {
	...
}
stats := metrics.NewStatsD(conn, time.Second)

Batches are limited by the flushInterval span. A flushInterval of 0 implies no buffering.

Jump to

Keyboard shortcuts

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